1c142477cSAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3c142477cSAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4c142477cSAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5c142477cSAndrew Rist  * distributed with this work for additional information
6c142477cSAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7c142477cSAndrew Rist  * to you under the Apache License, Version 2.0 (the
8c142477cSAndrew Rist  * "License"); you may not use this file except in compliance
9c142477cSAndrew Rist  * with the License.  You may obtain a copy of the License at
10c142477cSAndrew Rist  *
11c142477cSAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12c142477cSAndrew Rist  *
13c142477cSAndrew Rist  * Unless required by applicable law or agreed to in writing,
14c142477cSAndrew Rist  * software distributed under the License is distributed on an
15c142477cSAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16c142477cSAndrew Rist  * KIND, either express or implied.  See the License for the
17c142477cSAndrew Rist  * specific language governing permissions and limitations
18c142477cSAndrew Rist  * under the License.
19c142477cSAndrew Rist  *
20c142477cSAndrew Rist  *************************************************************/
21c142477cSAndrew Rist 
22c142477cSAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_sdext.hxx"
26cdf0e10cSrcweir 
27cdf0e10cSrcweir #include "optimizerdialog.hxx"
28*597a4c59SAriel Constenla-Haile #include "minimizer.hrc"
29*597a4c59SAriel Constenla-Haile #include "helpid.hrc"
30cdf0e10cSrcweir 
31cdf0e10cSrcweir // -------------------
32cdf0e10cSrcweir // - OptimizerDialog -
33cdf0e10cSrcweir // -------------------
34cdf0e10cSrcweir #include "pppoptimizer.hxx"
35cdf0e10cSrcweir #include "graphiccollector.hxx"
36cdf0e10cSrcweir #include "pagecollector.hxx"
37cdf0e10cSrcweir #include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
38cdf0e10cSrcweir #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
39cdf0e10cSrcweir #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
40cdf0e10cSrcweir #include <com/sun/star/awt/FontDescriptor.hpp>
41cdf0e10cSrcweir #ifndef _COM_SUN_STAR_AWT_XFONTWEIGHT_HPP_
42cdf0e10cSrcweir #include <com/sun/star/awt/FontWeight.hpp>
43cdf0e10cSrcweir #endif
44cdf0e10cSrcweir #include <rtl/ustrbuf.hxx>
45cdf0e10cSrcweir 
46cdf0e10cSrcweir using namespace ::com::sun::star::awt;
47cdf0e10cSrcweir using namespace ::com::sun::star::uno;
48cdf0e10cSrcweir using namespace ::com::sun::star::util;
49cdf0e10cSrcweir using namespace ::com::sun::star::lang;
50cdf0e10cSrcweir using namespace ::com::sun::star::frame;
51cdf0e10cSrcweir using namespace ::com::sun::star::beans;
52cdf0e10cSrcweir using namespace ::com::sun::star::script;
53cdf0e10cSrcweir using namespace ::com::sun::star::drawing;
54cdf0e10cSrcweir using namespace ::com::sun::star::container;
55cdf0e10cSrcweir using namespace ::com::sun::star::presentation;
56cdf0e10cSrcweir 
57*597a4c59SAriel Constenla-Haile using ::rtl::OUString;
58*597a4c59SAriel Constenla-Haile using ::rtl::OUStringBuffer;
59cdf0e10cSrcweir // -----------------------------------------------------------------------------
60cdf0e10cSrcweir 
ImplSetBold(const rtl::OUString & rControl)61*597a4c59SAriel Constenla-Haile void OptimizerDialog::ImplSetBold( const rtl::OUString& rControl )
62cdf0e10cSrcweir {
63cdf0e10cSrcweir 	FontDescriptor aFontDescriptor;
64*597a4c59SAriel Constenla-Haile 	if ( getControlProperty( rControl, TKGet( TK_FontDescriptor ) ) >>= aFontDescriptor )
65cdf0e10cSrcweir 	{
66cdf0e10cSrcweir 		aFontDescriptor.Weight = FontWeight::BOLD;
67*597a4c59SAriel Constenla-Haile 		setControlProperty( rControl, TKGet( TK_FontDescriptor ), Any( aFontDescriptor ) );
68cdf0e10cSrcweir 	}
69cdf0e10cSrcweir }
70cdf0e10cSrcweir 
71cdf0e10cSrcweir // -----------------------------------------------------------------------------
72cdf0e10cSrcweir 
ImplInsertSeparator(const OUString & rControlName,sal_Int32 nOrientation,sal_Int32 nPosX,sal_Int32 nPosY,sal_Int32 nWidth,sal_Int32 nHeight)73*597a4c59SAriel Constenla-Haile rtl::OUString OptimizerDialog::ImplInsertSeparator(
74*597a4c59SAriel Constenla-Haile     const OUString& rControlName,
75*597a4c59SAriel Constenla-Haile     sal_Int32 nOrientation,
76*597a4c59SAriel Constenla-Haile     sal_Int32 nPosX,
77*597a4c59SAriel Constenla-Haile     sal_Int32 nPosY,
78*597a4c59SAriel Constenla-Haile     sal_Int32 nWidth,
79*597a4c59SAriel Constenla-Haile     sal_Int32 nHeight )
80cdf0e10cSrcweir {
81cdf0e10cSrcweir 	OUString pNames[] = {
82cdf0e10cSrcweir 		TKGet( TK_Height ),
83cdf0e10cSrcweir 		TKGet( TK_Orientation ),
84cdf0e10cSrcweir 		TKGet( TK_PositionX ),
85cdf0e10cSrcweir 		TKGet( TK_PositionY ),
86cdf0e10cSrcweir 		TKGet( TK_Step ),
87cdf0e10cSrcweir 		TKGet( TK_Width ) };
88cdf0e10cSrcweir 
89cdf0e10cSrcweir 	Any	pValues[] = {
90cdf0e10cSrcweir 		Any( nHeight ),
91cdf0e10cSrcweir 		Any( nOrientation ),
92cdf0e10cSrcweir 		Any( nPosX ),
93cdf0e10cSrcweir 		Any( nPosY ),
94cdf0e10cSrcweir 		Any( sal_Int16( 0 ) ),
95cdf0e10cSrcweir 		Any( nWidth ) };
96cdf0e10cSrcweir 
97cdf0e10cSrcweir 	sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
98cdf0e10cSrcweir 
99cdf0e10cSrcweir 	Sequence< rtl::OUString >	aNames( pNames, nCount );
100cdf0e10cSrcweir 	Sequence< Any >				aValues( pValues, nCount );
101cdf0e10cSrcweir 
102*597a4c59SAriel Constenla-Haile 	insertControlModel( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlFixedLineModel" ) ),
103cdf0e10cSrcweir 		rControlName, aNames, aValues );
104cdf0e10cSrcweir 	return rControlName;
105cdf0e10cSrcweir }
106cdf0e10cSrcweir 
107cdf0e10cSrcweir // -----------------------------------------------------------------------------
108cdf0e10cSrcweir 
ImplInsertButton(const OUString & rControlName,const rtl::OUString & rHelpURL,sal_Int32 nXPos,sal_Int32 nYPos,sal_Int32 nWidth,sal_Int32 nHeight,sal_Int16 nTabIndex,sal_Bool bEnabled,sal_Int32 nResID,sal_Int16 nPushButtonType)109*597a4c59SAriel Constenla-Haile rtl::OUString OptimizerDialog::ImplInsertButton(
110*597a4c59SAriel Constenla-Haile     const OUString& rControlName,
111*597a4c59SAriel Constenla-Haile     const rtl::OUString& rHelpURL,
112*597a4c59SAriel Constenla-Haile     sal_Int32 nXPos,
113*597a4c59SAriel Constenla-Haile     sal_Int32 nYPos,
114*597a4c59SAriel Constenla-Haile     sal_Int32 nWidth,
115*597a4c59SAriel Constenla-Haile     sal_Int32 nHeight,
116*597a4c59SAriel Constenla-Haile     sal_Int16 nTabIndex,
117*597a4c59SAriel Constenla-Haile     sal_Bool bEnabled,
118*597a4c59SAriel Constenla-Haile     sal_Int32 nResID,
119*597a4c59SAriel Constenla-Haile     sal_Int16 nPushButtonType )
120cdf0e10cSrcweir {
121cdf0e10cSrcweir 	OUString pNames[] = {
122cdf0e10cSrcweir 		TKGet( TK_Enabled ),
123cdf0e10cSrcweir 		TKGet( TK_Height ),
124*597a4c59SAriel Constenla-Haile         TKGet( TK_HelpURL ),
125cdf0e10cSrcweir 		TKGet( TK_Label ),
126cdf0e10cSrcweir 		TKGet( TK_PositionX ),
127cdf0e10cSrcweir 		TKGet( TK_PositionY ),
128cdf0e10cSrcweir 		TKGet( TK_PushButtonType ),
129cdf0e10cSrcweir 		TKGet( TK_Step ),
130cdf0e10cSrcweir 		TKGet( TK_TabIndex ),
131cdf0e10cSrcweir 		TKGet( TK_Width ) };
132cdf0e10cSrcweir 
133cdf0e10cSrcweir 	Any	pValues[] = {
134cdf0e10cSrcweir 		Any( bEnabled  ),
135cdf0e10cSrcweir 		Any( nHeight ),
136*597a4c59SAriel Constenla-Haile         Any( rHelpURL ),
137*597a4c59SAriel Constenla-Haile 		Any( getString( nResID ) ),
138cdf0e10cSrcweir 		Any( nXPos ),
139cdf0e10cSrcweir 		Any( nYPos ),
140cdf0e10cSrcweir 		Any( nPushButtonType ),
141cdf0e10cSrcweir 		Any( (sal_Int16)0 ),
142cdf0e10cSrcweir 		Any( nTabIndex ),
143cdf0e10cSrcweir 		Any( nWidth ) };
144cdf0e10cSrcweir 
145cdf0e10cSrcweir 
146cdf0e10cSrcweir 	sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
147cdf0e10cSrcweir 
148cdf0e10cSrcweir 	Sequence< rtl::OUString >	aNames( pNames, nCount );
149cdf0e10cSrcweir 	Sequence< Any >				aValues( pValues, nCount );
150cdf0e10cSrcweir 
151*597a4c59SAriel Constenla-Haile 	insertButton( rControlName, this, aNames, aValues );
152cdf0e10cSrcweir 	return rControlName;
153cdf0e10cSrcweir }
154cdf0e10cSrcweir 
155cdf0e10cSrcweir // -----------------------------------------------------------------------------
156cdf0e10cSrcweir 
ImplInsertFixedText(const rtl::OUString & rControlName,const OUString & rLabel,sal_Int32 nXPos,sal_Int32 nYPos,sal_Int32 nWidth,sal_Int32 nHeight,sal_Bool bMultiLine,sal_Bool bBold,sal_Int16 nTabIndex)157*597a4c59SAriel Constenla-Haile rtl::OUString OptimizerDialog::ImplInsertFixedText(
158*597a4c59SAriel Constenla-Haile     const rtl::OUString& rControlName,
159*597a4c59SAriel Constenla-Haile     const OUString& rLabel,
160*597a4c59SAriel Constenla-Haile     sal_Int32 nXPos,
161*597a4c59SAriel Constenla-Haile     sal_Int32 nYPos,
162*597a4c59SAriel Constenla-Haile     sal_Int32 nWidth,
163*597a4c59SAriel Constenla-Haile     sal_Int32 nHeight,
164*597a4c59SAriel Constenla-Haile     sal_Bool bMultiLine,
165*597a4c59SAriel Constenla-Haile     sal_Bool bBold,
166*597a4c59SAriel Constenla-Haile     sal_Int16 nTabIndex )
167cdf0e10cSrcweir {
168cdf0e10cSrcweir 	OUString pNames[] = {
169cdf0e10cSrcweir 		TKGet( TK_Height ),
170cdf0e10cSrcweir 		TKGet( TK_Label ),
171cdf0e10cSrcweir 		TKGet( TK_MultiLine ),
172cdf0e10cSrcweir 		TKGet( TK_PositionX ),
173cdf0e10cSrcweir 		TKGet( TK_PositionY ),
174cdf0e10cSrcweir 		TKGet( TK_Step ),
175cdf0e10cSrcweir 		TKGet( TK_TabIndex ),
176cdf0e10cSrcweir 		TKGet( TK_Width ) };
177cdf0e10cSrcweir 
178cdf0e10cSrcweir 	Any	pValues[] = {
179cdf0e10cSrcweir 		Any( nHeight ),
180cdf0e10cSrcweir 		Any( rLabel ),
181cdf0e10cSrcweir 		Any( bMultiLine ),
182cdf0e10cSrcweir 		Any( nXPos ),
183cdf0e10cSrcweir 		Any( nYPos ),
184cdf0e10cSrcweir 		Any( (sal_Int16)0 ),
185cdf0e10cSrcweir 		Any( nTabIndex ),
186cdf0e10cSrcweir 		Any( nWidth ) };
187cdf0e10cSrcweir 
188cdf0e10cSrcweir 	sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
189cdf0e10cSrcweir 
190cdf0e10cSrcweir 	Sequence< rtl::OUString >	aNames( pNames, nCount );
191cdf0e10cSrcweir 	Sequence< Any >				aValues( pValues, nCount );
192cdf0e10cSrcweir 
193*597a4c59SAriel Constenla-Haile 	insertFixedText( rControlName, aNames, aValues );
194cdf0e10cSrcweir 	if ( bBold )
195*597a4c59SAriel Constenla-Haile 		ImplSetBold( rControlName );
196cdf0e10cSrcweir 	return rControlName;
197cdf0e10cSrcweir }
198cdf0e10cSrcweir 
199cdf0e10cSrcweir // -----------------------------------------------------------------------------
200cdf0e10cSrcweir 
ImplInsertCheckBox(const OUString & rControlName,const OUString & rLabel,const rtl::OUString & rHelpURL,sal_Int32 nXPos,sal_Int32 nYPos,sal_Int32 nWidth,sal_Int32 nHeight,sal_Int16 nTabIndex)201*597a4c59SAriel Constenla-Haile rtl::OUString OptimizerDialog::ImplInsertCheckBox(
202*597a4c59SAriel Constenla-Haile     const OUString& rControlName,
203*597a4c59SAriel Constenla-Haile     const OUString& rLabel,
204*597a4c59SAriel Constenla-Haile     const rtl::OUString& rHelpURL,
205*597a4c59SAriel Constenla-Haile     sal_Int32 nXPos,
206*597a4c59SAriel Constenla-Haile     sal_Int32 nYPos,
207*597a4c59SAriel Constenla-Haile     sal_Int32 nWidth,
208*597a4c59SAriel Constenla-Haile     sal_Int32 nHeight,
209*597a4c59SAriel Constenla-Haile     sal_Int16 nTabIndex )
210cdf0e10cSrcweir {
211cdf0e10cSrcweir 	OUString pNames[] = {
212cdf0e10cSrcweir 		TKGet( TK_Enabled ),
213cdf0e10cSrcweir 		TKGet( TK_Height ),
214*597a4c59SAriel Constenla-Haile         TKGet( TK_HelpURL ),
215cdf0e10cSrcweir 		TKGet( TK_Label ),
216cdf0e10cSrcweir 		TKGet( TK_PositionX ),
217cdf0e10cSrcweir 		TKGet( TK_PositionY ),
218cdf0e10cSrcweir 		TKGet( TK_Step ),
219cdf0e10cSrcweir 		TKGet( TK_TabIndex ),
220cdf0e10cSrcweir 		TKGet( TK_Width ) };
221cdf0e10cSrcweir 
222cdf0e10cSrcweir 	Any	pValues[] = {
223cdf0e10cSrcweir 		Any( sal_True ),
224cdf0e10cSrcweir 		Any( nHeight ),
225*597a4c59SAriel Constenla-Haile         Any( rHelpURL ),
226cdf0e10cSrcweir 		Any( rLabel ),
227cdf0e10cSrcweir 		Any( nXPos ),
228cdf0e10cSrcweir 		Any( nYPos ),
229cdf0e10cSrcweir 		Any( (sal_Int16)0 ),
230cdf0e10cSrcweir 		Any( nTabIndex ),
231cdf0e10cSrcweir 		Any( nWidth ) };
232cdf0e10cSrcweir 
233cdf0e10cSrcweir 	sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
234cdf0e10cSrcweir 
235cdf0e10cSrcweir 	Sequence< rtl::OUString >	aNames( pNames, nCount );
236cdf0e10cSrcweir 	Sequence< Any >				aValues( pValues, nCount );
237cdf0e10cSrcweir 
238*597a4c59SAriel Constenla-Haile 	Reference< XCheckBox > xCheckBox( insertCheckBox( rControlName, aNames, aValues ) );
239*597a4c59SAriel Constenla-Haile     xCheckBox->addItemListener( this );
240cdf0e10cSrcweir 	return rControlName;
241cdf0e10cSrcweir }
242cdf0e10cSrcweir 
243cdf0e10cSrcweir // -----------------------------------------------------------------------------
244cdf0e10cSrcweir 
ImplInsertFormattedField(const OUString & rControlName,const rtl::OUString & rHelpURL,sal_Int32 nXPos,sal_Int32 nYPos,sal_Int32 nWidth,double fEffectiveMin,double fEffectiveMax,sal_Int16 nTabIndex)245*597a4c59SAriel Constenla-Haile rtl::OUString OptimizerDialog::ImplInsertFormattedField(
246*597a4c59SAriel Constenla-Haile     const OUString& rControlName,
247*597a4c59SAriel Constenla-Haile     const rtl::OUString& rHelpURL,
248*597a4c59SAriel Constenla-Haile     sal_Int32 nXPos,
249*597a4c59SAriel Constenla-Haile     sal_Int32 nYPos,
250*597a4c59SAriel Constenla-Haile     sal_Int32 nWidth,
251*597a4c59SAriel Constenla-Haile     double fEffectiveMin,
252*597a4c59SAriel Constenla-Haile     double fEffectiveMax,
253*597a4c59SAriel Constenla-Haile     sal_Int16 nTabIndex )
254cdf0e10cSrcweir {
255cdf0e10cSrcweir 	OUString pNames[] = {
256cdf0e10cSrcweir 		TKGet( TK_EffectiveMax ),
257cdf0e10cSrcweir 		TKGet( TK_EffectiveMin ),
258cdf0e10cSrcweir 		TKGet( TK_Enabled ),
259cdf0e10cSrcweir 		TKGet( TK_Height ),
260*597a4c59SAriel Constenla-Haile         TKGet( TK_HelpURL ),
261cdf0e10cSrcweir 		TKGet( TK_PositionX ),
262cdf0e10cSrcweir 		TKGet( TK_PositionY ),
263cdf0e10cSrcweir 		TKGet( TK_Repeat ),
264cdf0e10cSrcweir 		TKGet( TK_Spin ),
265cdf0e10cSrcweir 		TKGet( TK_Step ),
266cdf0e10cSrcweir 		TKGet( TK_TabIndex ),
267cdf0e10cSrcweir 		TKGet( TK_Width ) };
268cdf0e10cSrcweir 
269cdf0e10cSrcweir 	Any	pValues[] = {
270cdf0e10cSrcweir 		Any( fEffectiveMax ),
271cdf0e10cSrcweir 		Any( fEffectiveMin ),
272cdf0e10cSrcweir 		Any( sal_True ),
273cdf0e10cSrcweir 		Any( (sal_Int32)12 ),
274*597a4c59SAriel Constenla-Haile         Any( rHelpURL ),
275cdf0e10cSrcweir 		Any( nXPos ),
276cdf0e10cSrcweir 		Any( nYPos ),
277cdf0e10cSrcweir 		Any( (sal_Bool)sal_True ),
278cdf0e10cSrcweir 		Any( (sal_Bool)sal_True ),
279cdf0e10cSrcweir 		Any( (sal_Int16)0 ),
280cdf0e10cSrcweir 		Any( nTabIndex ),
281cdf0e10cSrcweir 		Any( nWidth ) };
282cdf0e10cSrcweir 
283cdf0e10cSrcweir 	sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
284cdf0e10cSrcweir 
285cdf0e10cSrcweir 	Sequence< rtl::OUString >	aNames( pNames, nCount );
286cdf0e10cSrcweir 	Sequence< Any >				aValues( pValues, nCount );
287cdf0e10cSrcweir 
288*597a4c59SAriel Constenla-Haile 	Reference< XTextComponent > xTextComponent( insertFormattedField( rControlName, aNames, aValues ), UNO_QUERY_THROW );
289*597a4c59SAriel Constenla-Haile     xTextComponent->addTextListener( this );
290*597a4c59SAriel Constenla-Haile     Reference< XSpinField > xSpinField( xTextComponent, UNO_QUERY_THROW );
291*597a4c59SAriel Constenla-Haile     xSpinField->addSpinListener( this );
292*597a4c59SAriel Constenla-Haile 
293cdf0e10cSrcweir 	return rControlName;
294cdf0e10cSrcweir }
295cdf0e10cSrcweir 
296cdf0e10cSrcweir // -----------------------------------------------------------------------------
297cdf0e10cSrcweir 
ImplInsertComboBox(const OUString & rControlName,const rtl::OUString & rHelpURL,const sal_Bool bEnabled,const Sequence<OUString> & rItemList,sal_Int32 nXPos,sal_Int32 nYPos,sal_Int32 nWidth,sal_Int32 nHeight,sal_Int16 nTabIndex,bool bListen)298*597a4c59SAriel Constenla-Haile rtl::OUString OptimizerDialog::ImplInsertComboBox(
299*597a4c59SAriel Constenla-Haile     const OUString& rControlName,
300*597a4c59SAriel Constenla-Haile     const rtl::OUString& rHelpURL,
301*597a4c59SAriel Constenla-Haile     const sal_Bool bEnabled,
302*597a4c59SAriel Constenla-Haile     const Sequence< OUString >& rItemList,
303*597a4c59SAriel Constenla-Haile     sal_Int32 nXPos,
304*597a4c59SAriel Constenla-Haile     sal_Int32 nYPos,
305*597a4c59SAriel Constenla-Haile     sal_Int32 nWidth,
306*597a4c59SAriel Constenla-Haile     sal_Int32 nHeight,
307*597a4c59SAriel Constenla-Haile     sal_Int16 nTabIndex,
308*597a4c59SAriel Constenla-Haile     bool bListen )
309cdf0e10cSrcweir {
310cdf0e10cSrcweir 	OUString pNames[] = {
311cdf0e10cSrcweir 		TKGet( TK_Dropdown ),
312cdf0e10cSrcweir 		TKGet( TK_Enabled ),
313cdf0e10cSrcweir 		TKGet( TK_Height ),
314*597a4c59SAriel Constenla-Haile         TKGet( TK_HelpURL ),
315cdf0e10cSrcweir 		TKGet( TK_LineCount ),
316cdf0e10cSrcweir 		TKGet( TK_PositionX ),
317cdf0e10cSrcweir 		TKGet( TK_PositionY ),
318cdf0e10cSrcweir 		TKGet( TK_Step ),
319cdf0e10cSrcweir 		TKGet( TK_StringItemList ),
320cdf0e10cSrcweir 		TKGet( TK_TabIndex ),
321cdf0e10cSrcweir 		TKGet( TK_Width ) };
322cdf0e10cSrcweir 
323cdf0e10cSrcweir 	Any	pValues[] = {
324cdf0e10cSrcweir 		Any( sal_True ),
325cdf0e10cSrcweir 		Any( bEnabled ),
326cdf0e10cSrcweir 		Any( nHeight ),
327*597a4c59SAriel Constenla-Haile         Any( rHelpURL ),
328cdf0e10cSrcweir 		Any( (sal_Int16)8),
329cdf0e10cSrcweir 		Any( nXPos ),
330cdf0e10cSrcweir 		Any( nYPos ),
331cdf0e10cSrcweir 		Any( (sal_Int16)0 ),
332cdf0e10cSrcweir 		Any( rItemList ),
333cdf0e10cSrcweir 		Any( nTabIndex ),
334cdf0e10cSrcweir 		Any( nWidth ) };
335cdf0e10cSrcweir 
336cdf0e10cSrcweir 	sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
337cdf0e10cSrcweir 
338cdf0e10cSrcweir 	Sequence< rtl::OUString >	aNames( pNames, nCount );
339cdf0e10cSrcweir 	Sequence< Any >				aValues( pValues, nCount );
340cdf0e10cSrcweir 
341*597a4c59SAriel Constenla-Haile 	Reference< XTextComponent > xTextComponent( insertComboBox( rControlName, aNames, aValues ), UNO_QUERY_THROW );
342*597a4c59SAriel Constenla-Haile     if ( bListen )
343*597a4c59SAriel Constenla-Haile         xTextComponent->addTextListener( this );
344cdf0e10cSrcweir 	return rControlName;
345cdf0e10cSrcweir }
346cdf0e10cSrcweir 
347cdf0e10cSrcweir // -----------------------------------------------------------------------------
348cdf0e10cSrcweir 
ImplInsertRadioButton(const rtl::OUString & rControlName,const OUString & rLabel,const rtl::OUString & rHelpURL,sal_Int32 nXPos,sal_Int32 nYPos,sal_Int32 nWidth,sal_Int32 nHeight,sal_Bool bMultiLine,sal_Int16 nTabIndex)349*597a4c59SAriel Constenla-Haile rtl::OUString OptimizerDialog::ImplInsertRadioButton(
350*597a4c59SAriel Constenla-Haile     const rtl::OUString& rControlName,
351*597a4c59SAriel Constenla-Haile     const OUString& rLabel,
352*597a4c59SAriel Constenla-Haile     const rtl::OUString& rHelpURL,
353*597a4c59SAriel Constenla-Haile     sal_Int32 nXPos,
354*597a4c59SAriel Constenla-Haile     sal_Int32 nYPos,
355*597a4c59SAriel Constenla-Haile     sal_Int32 nWidth,
356*597a4c59SAriel Constenla-Haile     sal_Int32 nHeight,
357*597a4c59SAriel Constenla-Haile     sal_Bool bMultiLine,
358*597a4c59SAriel Constenla-Haile     sal_Int16 nTabIndex )
359cdf0e10cSrcweir {
360cdf0e10cSrcweir 	OUString pNames[] = {
361cdf0e10cSrcweir 		TKGet( TK_Height ),
362*597a4c59SAriel Constenla-Haile         TKGet( TK_HelpURL ),
363cdf0e10cSrcweir 		TKGet( TK_Label ),
364cdf0e10cSrcweir 		TKGet( TK_MultiLine ),
365cdf0e10cSrcweir 		TKGet( TK_PositionX ),
366cdf0e10cSrcweir 		TKGet( TK_PositionY ),
367cdf0e10cSrcweir 		TKGet( TK_Step ),
368cdf0e10cSrcweir 		TKGet( TK_TabIndex ),
369cdf0e10cSrcweir 		TKGet( TK_Width ) };
370cdf0e10cSrcweir 
371cdf0e10cSrcweir 	Any	pValues[] = {
372cdf0e10cSrcweir 		Any( nHeight ),
373*597a4c59SAriel Constenla-Haile         Any( rHelpURL ),
374cdf0e10cSrcweir 		Any( rLabel ),
375cdf0e10cSrcweir 		Any( bMultiLine ),
376cdf0e10cSrcweir 		Any( nXPos ),
377cdf0e10cSrcweir 		Any( nYPos ),
378cdf0e10cSrcweir 		Any( (sal_Int16)0 ),
379cdf0e10cSrcweir 		Any( nTabIndex ),
380cdf0e10cSrcweir 		Any( nWidth ) };
381cdf0e10cSrcweir 
382cdf0e10cSrcweir 	sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
383cdf0e10cSrcweir 
384cdf0e10cSrcweir 	Sequence< rtl::OUString >	aNames( pNames, nCount );
385cdf0e10cSrcweir 	Sequence< Any >				aValues( pValues, nCount );
386cdf0e10cSrcweir 
387*597a4c59SAriel Constenla-Haile 	Reference< XRadioButton > xRadioButton( insertRadioButton( rControlName, aNames, aValues ) );
388*597a4c59SAriel Constenla-Haile     xRadioButton->addItemListener( this );
389cdf0e10cSrcweir 	return rControlName;
390cdf0e10cSrcweir }
391cdf0e10cSrcweir 
392cdf0e10cSrcweir // -----------------------------------------------------------------------------
393cdf0e10cSrcweir 
ImplInsertListBox(const OUString & rControlName,const rtl::OUString & rHelpURL,const sal_Bool bEnabled,const Sequence<OUString> & rItemList,sal_Int32 nXPos,sal_Int32 nYPos,sal_Int32 nWidth,sal_Int32 nHeight,sal_Int16 nTabIndex)394*597a4c59SAriel Constenla-Haile rtl::OUString OptimizerDialog::ImplInsertListBox(
395*597a4c59SAriel Constenla-Haile     const OUString& rControlName,
396*597a4c59SAriel Constenla-Haile     const rtl::OUString& rHelpURL,
397*597a4c59SAriel Constenla-Haile     const sal_Bool bEnabled,
398*597a4c59SAriel Constenla-Haile     const Sequence< OUString >& rItemList,
399*597a4c59SAriel Constenla-Haile     sal_Int32 nXPos,
400*597a4c59SAriel Constenla-Haile     sal_Int32 nYPos,
401*597a4c59SAriel Constenla-Haile     sal_Int32 nWidth,
402*597a4c59SAriel Constenla-Haile     sal_Int32 nHeight,
403*597a4c59SAriel Constenla-Haile     sal_Int16 nTabIndex )
404cdf0e10cSrcweir {
405cdf0e10cSrcweir 	OUString pNames[] = {
406cdf0e10cSrcweir 		TKGet( TK_Dropdown ),
407cdf0e10cSrcweir 		TKGet( TK_Enabled ),
408cdf0e10cSrcweir 		TKGet( TK_Height ),
409*597a4c59SAriel Constenla-Haile         TKGet( TK_HelpURL ),
410cdf0e10cSrcweir 		TKGet( TK_LineCount ),
411cdf0e10cSrcweir 		TKGet( TK_MultiSelection ),
412cdf0e10cSrcweir 		TKGet( TK_PositionX ),
413cdf0e10cSrcweir 		TKGet( TK_PositionY ),
414cdf0e10cSrcweir 		TKGet( TK_Step ),
415cdf0e10cSrcweir 		TKGet( TK_StringItemList ),
416cdf0e10cSrcweir 		TKGet( TK_TabIndex ),
417cdf0e10cSrcweir 		TKGet( TK_Width ) };
418cdf0e10cSrcweir 
419cdf0e10cSrcweir 	Any	pValues[] = {
420cdf0e10cSrcweir 		Any( sal_True ),
421cdf0e10cSrcweir 		Any( bEnabled ),
422cdf0e10cSrcweir 		Any( nHeight ),
423*597a4c59SAriel Constenla-Haile         Any( rHelpURL ),
424cdf0e10cSrcweir 		Any( (sal_Int16)8),
425cdf0e10cSrcweir 		Any( sal_False ),
426cdf0e10cSrcweir 		Any( nXPos ),
427cdf0e10cSrcweir 		Any( nYPos ),
428cdf0e10cSrcweir 		Any( (sal_Int16)0 ),
429cdf0e10cSrcweir 		Any( rItemList ),
430cdf0e10cSrcweir 		Any( nTabIndex ),
431cdf0e10cSrcweir 		Any( nWidth ) };
432cdf0e10cSrcweir 
433cdf0e10cSrcweir 	sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
434cdf0e10cSrcweir 
435cdf0e10cSrcweir 	Sequence< rtl::OUString >	aNames( pNames, nCount );
436cdf0e10cSrcweir 	Sequence< Any >				aValues( pValues, nCount );
437cdf0e10cSrcweir 
438*597a4c59SAriel Constenla-Haile 	Reference< XListBox > xListBox( insertListBox( rControlName, aNames, aValues ) );
439*597a4c59SAriel Constenla-Haile     xListBox->addActionListener( this );
440cdf0e10cSrcweir 	return rControlName;
441cdf0e10cSrcweir }
442cdf0e10cSrcweir 
443cdf0e10cSrcweir // -----------------------------------------------------------------------------
444cdf0e10cSrcweir 
InitNavigationBar()445cdf0e10cSrcweir void OptimizerDialog::InitNavigationBar()
446cdf0e10cSrcweir {
447cdf0e10cSrcweir     sal_Int32	nCancelPosX = OD_DIALOG_WIDTH - BUTTON_WIDTH - 6;
448cdf0e10cSrcweir     sal_Int32	nFinishPosX = nCancelPosX - 6 - BUTTON_WIDTH;
449cdf0e10cSrcweir     sal_Int32	nNextPosX = nFinishPosX - 6 - BUTTON_WIDTH;
450cdf0e10cSrcweir     sal_Int32	nBackPosX = nNextPosX - 3 - BUTTON_WIDTH;
451cdf0e10cSrcweir 
452*597a4c59SAriel Constenla-Haile 	ImplInsertSeparator( TKGet( TK_lnNavSep1 ), 0, 0, DIALOG_HEIGHT - 26, OD_DIALOG_WIDTH, 1 );
453*597a4c59SAriel Constenla-Haile 	ImplInsertSeparator( TKGet( TK_lnNavSep2 ), 1, 85, 0, 1, BUTTON_POS_Y - 6 );
454cdf0e10cSrcweir 
455*597a4c59SAriel Constenla-Haile 	ImplInsertButton( TKGet( TK_btnNavHelp ), HID( HID_SDEXT_MINIMIZER_WIZ_PB_HELP ), 8, BUTTON_POS_Y, BUTTON_WIDTH, BUTTON_HEIGHT, mnTabIndex++, sal_True, STR_HELP, PushButtonType_HELP );
456*597a4c59SAriel Constenla-Haile 	ImplInsertButton( TKGet( TK_btnNavBack ), HID( HID_SDEXT_MINIMIZER_WIZ_PB_BACK ), nBackPosX, BUTTON_POS_Y, BUTTON_WIDTH, BUTTON_HEIGHT, mnTabIndex++, sal_False, STR_BACK, PushButtonType_STANDARD );
457*597a4c59SAriel Constenla-Haile 	ImplInsertButton( TKGet( TK_btnNavNext ), HID( HID_SDEXT_MINIMIZER_WIZ_PB_NEXT ), nNextPosX, BUTTON_POS_Y, BUTTON_WIDTH, BUTTON_HEIGHT, mnTabIndex++, sal_True, STR_NEXT, PushButtonType_STANDARD );
458*597a4c59SAriel Constenla-Haile 	ImplInsertButton( TKGet( TK_btnNavFinish ), HID( HID_SDEXT_MINIMIZER_WIZ_PB_FINISH ), nFinishPosX, BUTTON_POS_Y, BUTTON_WIDTH, BUTTON_HEIGHT, mnTabIndex++, sal_True, STR_FINISH, PushButtonType_STANDARD );
459*597a4c59SAriel Constenla-Haile 	ImplInsertButton( TKGet( TK_btnNavCancel ), HID( HID_SDEXT_MINIMIZER_WIZ_PB_CANCEL ), nCancelPosX, BUTTON_POS_Y, BUTTON_WIDTH, BUTTON_HEIGHT, mnTabIndex++, sal_True, STR_CANCEL, PushButtonType_STANDARD );
460cdf0e10cSrcweir 
461cdf0e10cSrcweir 	setControlProperty( TKGet( TK_btnNavNext ), TKGet( TK_DefaultButton ), Any( sal_True ) );
462cdf0e10cSrcweir }
463cdf0e10cSrcweir 
464cdf0e10cSrcweir // -----------------------------------------------------------------------------
465cdf0e10cSrcweir 
UpdateControlStatesPage0()466cdf0e10cSrcweir void OptimizerDialog::UpdateControlStatesPage0()
467cdf0e10cSrcweir {
468cdf0e10cSrcweir 	sal_uInt32 i;
469cdf0e10cSrcweir 	short nSelectedItem = -1;
470cdf0e10cSrcweir 	Sequence< OUString > aItemList;
471cdf0e10cSrcweir 	const std::vector< OptimizerSettings >& rList( GetOptimizerSettings() );
472cdf0e10cSrcweir 	if ( rList.size() > 1 )	// the first session in the list is the actual one -> skipping first one
473cdf0e10cSrcweir 	{
474cdf0e10cSrcweir 		aItemList.realloc( rList.size() - 1 );
475cdf0e10cSrcweir 		for ( i = 1; i < rList.size(); i++ )
476cdf0e10cSrcweir 		{
477cdf0e10cSrcweir 			aItemList[ i - 1 ] = rList[ i ].maName;
478cdf0e10cSrcweir 			if ( nSelectedItem < 0 )
479cdf0e10cSrcweir 			{
480cdf0e10cSrcweir 				if ( rList[ i ] == rList[ 0 ] )
481cdf0e10cSrcweir 					nSelectedItem = static_cast< short >( i - 1 );
482cdf0e10cSrcweir 			}
483cdf0e10cSrcweir 		}
484cdf0e10cSrcweir 	}
485cdf0e10cSrcweir 	sal_Bool bRemoveButtonEnabled = sal_False;
486cdf0e10cSrcweir 	Sequence< short > aSelectedItems;
487cdf0e10cSrcweir 	if ( nSelectedItem >= 0 )
488cdf0e10cSrcweir 	{
489cdf0e10cSrcweir 		aSelectedItems.realloc( 1 );
490cdf0e10cSrcweir 		aSelectedItems[ 0 ] = nSelectedItem;
491cdf0e10cSrcweir 		if ( nSelectedItem > 2 )	// only allowing to delete custom themes, the first can|t be deleted
492cdf0e10cSrcweir 			bRemoveButtonEnabled = sal_True;
493cdf0e10cSrcweir 	}
494cdf0e10cSrcweir 	setControlProperty( TKGet( TK_ListBox0Pg0 ), TKGet( TK_StringItemList ), Any( aItemList ) );
495cdf0e10cSrcweir 	setControlProperty( TKGet( TK_ListBox0Pg0 ), TKGet( TK_SelectedItems ), Any( aSelectedItems ) );
496cdf0e10cSrcweir 	setControlProperty( TKGet( TK_Button0Pg0 ), TKGet( TK_Enabled ), Any( bRemoveButtonEnabled ) );
497cdf0e10cSrcweir }
InitPage0()498cdf0e10cSrcweir void OptimizerDialog::InitPage0()
499cdf0e10cSrcweir {
500cdf0e10cSrcweir 	Sequence< OUString > aItemList;
501cdf0e10cSrcweir 	std::vector< rtl::OUString > aControlList;
502*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText0Pg0 ), getString( STR_INTRODUCTION ), PAGE_POS_X, PAGE_POS_Y, PAGE_WIDTH, 8, sal_False, sal_True, mnTabIndex++ ) );
503*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText1Pg0 ), getString( STR_INTRODUCTION_T ), PAGE_POS_X + 6, PAGE_POS_Y + 14, PAGE_WIDTH - 12, 100, sal_True, sal_False, mnTabIndex++ ) );
504*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertSeparator( TKGet( TK_Separator1Pg0 ), 0, PAGE_POS_X + 6, DIALOG_HEIGHT - 66, PAGE_WIDTH - 12, 1 ) );
505*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText2Pg0 ), getString( STR_CHOSE_SETTINGS ), PAGE_POS_X + 6, DIALOG_HEIGHT - 60, PAGE_WIDTH - 12, 8, sal_True, sal_False, mnTabIndex++ ) );
506*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertListBox(  TKGet( TK_ListBox0Pg0 ), HID(HID_SDEXT_MINIMIZER_WIZ_STEP1_LB_SETTINGS),sal_True, aItemList, PAGE_POS_X + 6, DIALOG_HEIGHT - 48, ( OD_DIALOG_WIDTH - 50 ) - ( PAGE_POS_X + 6 ), 12, mnTabIndex++ ) );
507*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertButton( TKGet( TK_Button0Pg0 ), HID( HID_SDEXT_MINIMIZER_WIZ_STEP1_PB_DELSETTS ),OD_DIALOG_WIDTH - 46, DIALOG_HEIGHT - 49, 40, 14, mnTabIndex++, sal_True, STR_REMOVE, PushButtonType_STANDARD ) );
508cdf0e10cSrcweir 	maControlPages.push_back( aControlList );
509cdf0e10cSrcweir 	DeactivatePage( 0 );
510cdf0e10cSrcweir 	UpdateControlStatesPage0();
511cdf0e10cSrcweir }
512cdf0e10cSrcweir 
513cdf0e10cSrcweir // -----------------------------------------------------------------------------
514cdf0e10cSrcweir 
UpdateControlStatesPage1()515cdf0e10cSrcweir void OptimizerDialog::UpdateControlStatesPage1()
516cdf0e10cSrcweir {
517cdf0e10cSrcweir 	sal_Bool bDeleteUnusedMasterPages( GetConfigProperty( TK_DeleteUnusedMasterPages, sal_False ) );
518cdf0e10cSrcweir 	sal_Bool bDeleteHiddenSlides( GetConfigProperty( TK_DeleteHiddenSlides, sal_False ) );
519cdf0e10cSrcweir 	sal_Bool bDeleteNotesPages( GetConfigProperty( TK_DeleteNotesPages, sal_False ) );
520cdf0e10cSrcweir 
521cdf0e10cSrcweir 	setControlProperty( TKGet( TK_CheckBox0Pg3 ), TKGet( TK_State ), Any( (sal_Int16)bDeleteUnusedMasterPages ) );
522cdf0e10cSrcweir 	setControlProperty( TKGet( TK_CheckBox1Pg3 ), TKGet( TK_State ), Any( (sal_Int16)bDeleteNotesPages ) );
523cdf0e10cSrcweir 	setControlProperty( TKGet( TK_CheckBox2Pg3 ), TKGet( TK_State ), Any( (sal_Int16)bDeleteHiddenSlides ) );
524cdf0e10cSrcweir }
InitPage1()525cdf0e10cSrcweir void OptimizerDialog::InitPage1()
526cdf0e10cSrcweir {
527cdf0e10cSrcweir 	Sequence< OUString > aCustomShowList;
528*597a4c59SAriel Constenla-Haile 	Reference< XModel > xModel( mxModel );
529cdf0e10cSrcweir 	if ( xModel.is() )
530cdf0e10cSrcweir 	{
531cdf0e10cSrcweir 		Reference< XCustomPresentationSupplier > aXCPSup( xModel, UNO_QUERY_THROW );
532cdf0e10cSrcweir 		Reference< XNameContainer > aXCont( aXCPSup->getCustomPresentations() );
533cdf0e10cSrcweir         if ( aXCont.is() )
534cdf0e10cSrcweir             aCustomShowList = aXCont->getElementNames();
535cdf0e10cSrcweir 	}
536cdf0e10cSrcweir 	std::vector< rtl::OUString > aControlList;
537*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText0Pg3 ), getString( STR_CHOOSE_SLIDES ), PAGE_POS_X, PAGE_POS_Y, PAGE_WIDTH, 8, sal_False, sal_True, mnTabIndex++ ) );
538*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertCheckBox(  TKGet( TK_CheckBox0Pg3 ), getString( STR_DELETE_MASTER_PAGES ), HID( HID_SDEXT_MINIMIZER_WIZ_STEP2_CB_MASTERPAGES ), PAGE_POS_X + 6, PAGE_POS_Y + 14, PAGE_WIDTH - 12, 8, mnTabIndex++ ) );
539*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertCheckBox(  TKGet( TK_CheckBox2Pg3 ), getString( STR_DELETE_HIDDEN_SLIDES ), HID( HID_SDEXT_MINIMIZER_WIZ_STEP2_CB_HIDDENSLIDES ), PAGE_POS_X + 6, PAGE_POS_Y + 28, PAGE_WIDTH - 12, 8, mnTabIndex++ ) );
540*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertCheckBox(  TKGet( TK_CheckBox3Pg3 ), getString( STR_CUSTOM_SHOW ), HID( HID_SDEXT_MINIMIZER_WIZ_STEP2_CB_CUSTOMSHOW ), PAGE_POS_X + 6, PAGE_POS_Y + 42, PAGE_WIDTH - 12, 8, mnTabIndex++ ) );
541*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertListBox(  TKGet( TK_ListBox0Pg3 ), HID(HID_SDEXT_MINIMIZER_WIZ_STEP2_LB_CUSTOMSHOW),sal_True, aCustomShowList, PAGE_POS_X + 14, PAGE_POS_Y + 54, 150, 12, mnTabIndex++ ) );
542*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertCheckBox(  TKGet( TK_CheckBox1Pg3 ), getString( STR_DELETE_NOTES_PAGES ), HID( HID_SDEXT_MINIMIZER_WIZ_STEP2_CB_NOTES ), PAGE_POS_X + 6, PAGE_POS_Y + 70, PAGE_WIDTH - 12, 8, mnTabIndex++ ) );
543cdf0e10cSrcweir 	maControlPages.push_back( aControlList );
544cdf0e10cSrcweir 	DeactivatePage( 1 );
545cdf0e10cSrcweir 
546cdf0e10cSrcweir 	setControlProperty( TKGet( TK_CheckBox3Pg3 ), TKGet( TK_State ), Any( sal_False ) );
547cdf0e10cSrcweir 	setControlProperty( TKGet( TK_CheckBox3Pg3 ), TKGet( TK_Enabled ), Any( aCustomShowList.getLength() != 0 ) );
548cdf0e10cSrcweir 	setControlProperty( TKGet( TK_ListBox0Pg3 ), TKGet( TK_Enabled ), Any( sal_False ) );
549cdf0e10cSrcweir 
550cdf0e10cSrcweir 	UpdateControlStatesPage1();
551cdf0e10cSrcweir }
552cdf0e10cSrcweir 
553cdf0e10cSrcweir // -----------------------------------------------------------------------------
554cdf0e10cSrcweir 
UpdateControlStatesPage2()555cdf0e10cSrcweir void OptimizerDialog::UpdateControlStatesPage2()
556cdf0e10cSrcweir {
557cdf0e10cSrcweir 	sal_Bool bJPEGCompression( GetConfigProperty( TK_JPEGCompression, sal_False ) );
558cdf0e10cSrcweir 	sal_Bool bRemoveCropArea( GetConfigProperty( TK_RemoveCropArea, sal_False ) );
559cdf0e10cSrcweir 	sal_Bool bEmbedLinkedGraphics( GetConfigProperty( TK_EmbedLinkedGraphics, sal_True ) );
560cdf0e10cSrcweir 	sal_Int32 nJPEGQuality( GetConfigProperty( TK_JPEGQuality, (sal_Int32)90 ) );
561cdf0e10cSrcweir 
562cdf0e10cSrcweir 	sal_Int32 nImageResolution( GetConfigProperty( TK_ImageResolution, (sal_Int32)0 ) );
563cdf0e10cSrcweir 
564cdf0e10cSrcweir 	sal_Int32 nI0, nI1, nI2, nI3;
565cdf0e10cSrcweir 	nI0 = nI1 = nI2 = nI3 = 0;
566cdf0e10cSrcweir 	OUString aResolutionText;
567cdf0e10cSrcweir 	Sequence< OUString > aResolutionItemList( 4 );
568cdf0e10cSrcweir 	aResolutionItemList[ 0 ] = getString( STR_IMAGE_RESOLUTION_0 ).getToken( 1, ';', nI0 );
569cdf0e10cSrcweir 	aResolutionItemList[ 1 ] = getString( STR_IMAGE_RESOLUTION_1 ).getToken( 1, ';', nI1 );
570cdf0e10cSrcweir 	aResolutionItemList[ 2 ] = getString( STR_IMAGE_RESOLUTION_2 ).getToken( 1, ';', nI2 );
571cdf0e10cSrcweir 	aResolutionItemList[ 3 ] = getString( STR_IMAGE_RESOLUTION_3 ).getToken( 1, ';', nI3 );
572cdf0e10cSrcweir 	nI0 = nI1 = nI2 = nI3 = 0;
573cdf0e10cSrcweir 	if ( getString( STR_IMAGE_RESOLUTION_0 ).getToken( 0, ';', nI0 ).toInt32() == nImageResolution )
574cdf0e10cSrcweir 		aResolutionText = aResolutionItemList[ 0 ];
575cdf0e10cSrcweir 	else if ( getString( STR_IMAGE_RESOLUTION_1 ).getToken( 0, ';', nI1 ).toInt32() == nImageResolution )
576cdf0e10cSrcweir 		aResolutionText = aResolutionItemList[ 1 ];
577cdf0e10cSrcweir 	else if ( getString( STR_IMAGE_RESOLUTION_2 ).getToken( 0, ';', nI2 ).toInt32() == nImageResolution )
578cdf0e10cSrcweir 		aResolutionText = aResolutionItemList[ 2 ];
579cdf0e10cSrcweir 	else if ( getString( STR_IMAGE_RESOLUTION_3 ).getToken( 0, ';', nI3 ).toInt32() == nImageResolution )
580cdf0e10cSrcweir 		aResolutionText = aResolutionItemList[ 3 ];
581cdf0e10cSrcweir 	if ( !aResolutionText.getLength() )
582cdf0e10cSrcweir 		aResolutionText = OUString::valueOf( nImageResolution );
583cdf0e10cSrcweir 
584cdf0e10cSrcweir 	setControlProperty( TKGet( TK_RadioButton0Pg1 ), TKGet( TK_State ), Any( (sal_Int16)( bJPEGCompression != sal_True ) ) );
585cdf0e10cSrcweir 	setControlProperty( TKGet( TK_RadioButton1Pg1 ), TKGet( TK_State ), Any( (sal_Int16)( bJPEGCompression != sal_False ) ) );
586cdf0e10cSrcweir 	setControlProperty( TKGet( TK_FixedText1Pg1  ), TKGet( TK_Enabled ), Any( bJPEGCompression ) );
587cdf0e10cSrcweir 	setControlProperty( TKGet( TK_FormattedField0Pg1 ), TKGet( TK_Enabled ), Any( bJPEGCompression ) );
588cdf0e10cSrcweir 	setControlProperty( TKGet( TK_FormattedField0Pg1 ), TKGet( TK_EffectiveValue ), Any( (double)nJPEGQuality ) );
589cdf0e10cSrcweir 	setControlProperty( TKGet( TK_CheckBox1Pg1 ), TKGet( TK_State ), Any( (sal_Int16)bRemoveCropArea ) );
590cdf0e10cSrcweir 	setControlProperty( TKGet( TK_ComboBox0Pg1 ), TKGet( TK_Text ), Any( aResolutionText ) );
591cdf0e10cSrcweir 	setControlProperty( TKGet( TK_CheckBox2Pg1 ), TKGet( TK_State ), Any( (sal_Int16)bEmbedLinkedGraphics ) );
592cdf0e10cSrcweir }
InitPage2()593cdf0e10cSrcweir void OptimizerDialog::InitPage2()
594cdf0e10cSrcweir {
595cdf0e10cSrcweir 	sal_Int32 nI0, nI1, nI2, nI3;
596cdf0e10cSrcweir 	nI0 = nI1 = nI2 = nI3 = 0;
597cdf0e10cSrcweir 	Sequence< OUString > aResolutionItemList( 4 );
598cdf0e10cSrcweir 	aResolutionItemList[ 0 ] = getString( STR_IMAGE_RESOLUTION_0 ).getToken( 1, ';', nI0 );
599cdf0e10cSrcweir 	aResolutionItemList[ 1 ] = getString( STR_IMAGE_RESOLUTION_1 ).getToken( 1, ';', nI1 );
600cdf0e10cSrcweir 	aResolutionItemList[ 2 ] = getString( STR_IMAGE_RESOLUTION_2 ).getToken( 1, ';', nI2 );
601cdf0e10cSrcweir 	aResolutionItemList[ 3 ] = getString( STR_IMAGE_RESOLUTION_3 ).getToken( 1, ';', nI3 );
602cdf0e10cSrcweir 
603cdf0e10cSrcweir 	std::vector< rtl::OUString > aControlList;
604*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText0Pg1 ), getString( STR_GRAPHIC_OPTIMIZATION ), PAGE_POS_X, PAGE_POS_Y, PAGE_WIDTH, 8, sal_False, sal_True, mnTabIndex++ ) );
605*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertRadioButton( TKGet( TK_RadioButton0Pg1 ), getString( STR_LOSSLESS_COMPRESSION ), HID( HID_SDEXT_MINIMIZER_WIZ_STEP3_RB_LOSSLESS ), PAGE_POS_X + 6, PAGE_POS_Y + 14, PAGE_WIDTH - 12, 8, sal_False, mnTabIndex++ ) );
606*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertRadioButton( TKGet( TK_RadioButton1Pg1 ), getString( STR_JPEG_COMPRESSION ), HID( HID_SDEXT_MINIMIZER_WIZ_STEP3_RB_JPEG ), PAGE_POS_X + 6, PAGE_POS_Y + 28, PAGE_WIDTH - 12, 8, sal_False, mnTabIndex++ ) );
607*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText1Pg1 ), getString( STR_QUALITY ), PAGE_POS_X + 20, PAGE_POS_Y + 40, 72, 8, sal_False, sal_False, mnTabIndex++ ) );
608*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFormattedField( TKGet( TK_FormattedField0Pg1 ), HID( HID_SDEXT_MINIMIZER_WIZ_STEP3_MF_QUALITY ), PAGE_POS_X + 106, PAGE_POS_Y + 38, 50, 0, 100, mnTabIndex++ ) );
609*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText2Pg1 ), getString( STR_IMAGE_RESOLUTION ), PAGE_POS_X + 6, PAGE_POS_Y + 54, 94, 8, sal_False, sal_False, mnTabIndex++ ) );
610*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertComboBox(  TKGet( TK_ComboBox0Pg1 ), HID( HID_SDEXT_MINIMIZER_WIZ_STEP3_LB_DPI ), sal_True, aResolutionItemList, PAGE_POS_X + 106, PAGE_POS_Y + 52, 100, 12, mnTabIndex++ ) );
611*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertCheckBox(  TKGet( TK_CheckBox1Pg1 ), getString( STR_REMOVE_CROP_AREA ), HID( HID_SDEXT_MINIMIZER_WIZ_STEP3_CB_CROP ), PAGE_POS_X + 6, PAGE_POS_Y + 68, PAGE_WIDTH - 12, 8, mnTabIndex++ ) );
612*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertCheckBox(  TKGet( TK_CheckBox2Pg1 ), getString( STR_EMBED_LINKED_GRAPHICS ), HID( HID_SDEXT_MINIMIZER_WIZ_STEP3_CB_LINKS ), PAGE_POS_X + 6, PAGE_POS_Y + 82, PAGE_WIDTH - 12, 8, mnTabIndex++ ) );
613cdf0e10cSrcweir 	maControlPages.push_back( aControlList );
614cdf0e10cSrcweir 	DeactivatePage( 2 );
615cdf0e10cSrcweir 	UpdateControlStatesPage2();
616cdf0e10cSrcweir }
617cdf0e10cSrcweir 
618cdf0e10cSrcweir // -----------------------------------------------------------------------------
619cdf0e10cSrcweir 
UpdateControlStatesPage3()620cdf0e10cSrcweir void OptimizerDialog::UpdateControlStatesPage3()
621cdf0e10cSrcweir {
622cdf0e10cSrcweir 	sal_Bool bConvertOLEObjects( GetConfigProperty( TK_OLEOptimization, sal_False ) );
623cdf0e10cSrcweir 	sal_Int16 nOLEOptimizationType( GetConfigProperty( TK_OLEOptimizationType, (sal_Int16)0 ) );
624cdf0e10cSrcweir 
625cdf0e10cSrcweir 	setControlProperty( TKGet( TK_CheckBox0Pg2 ), TKGet( TK_State ), Any( (sal_Int16)bConvertOLEObjects ) );
626cdf0e10cSrcweir 	setControlProperty( TKGet( TK_RadioButton0Pg2 ), TKGet( TK_Enabled ), Any( bConvertOLEObjects ) );
627cdf0e10cSrcweir 	setControlProperty( TKGet( TK_RadioButton0Pg2 ), TKGet( TK_State ), Any( (sal_Int16)( nOLEOptimizationType == 0 ) ) );
628cdf0e10cSrcweir 	setControlProperty( TKGet( TK_RadioButton1Pg2 ), TKGet( TK_Enabled ), Any( bConvertOLEObjects ) );
629cdf0e10cSrcweir 	setControlProperty( TKGet( TK_RadioButton1Pg2 ), TKGet( TK_State ), Any( (sal_Int16)( nOLEOptimizationType == 1 ) ) );
630cdf0e10cSrcweir }
InitPage3()631cdf0e10cSrcweir void OptimizerDialog::InitPage3()
632cdf0e10cSrcweir {
633cdf0e10cSrcweir 	int nOLECount = 0;
634*597a4c59SAriel Constenla-Haile 	Reference< XModel > xModel( mxModel );
635cdf0e10cSrcweir 	Reference< XDrawPagesSupplier > xDrawPagesSupplier( xModel, UNO_QUERY_THROW );
636cdf0e10cSrcweir 	Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY_THROW );
637cdf0e10cSrcweir 	for ( sal_Int32 i = 0; i < xDrawPages->getCount(); i++ )
638cdf0e10cSrcweir 	{
639cdf0e10cSrcweir 		Reference< XShapes > xShapes( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
640cdf0e10cSrcweir 		for ( sal_Int32 j = 0; j < xShapes->getCount(); j++ )
641cdf0e10cSrcweir 		{
642cdf0e10cSrcweir 			const OUString sOLE2Shape( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.OLE2Shape" ) );
643cdf0e10cSrcweir 			Reference< XShape > xShape( xShapes->getByIndex( j ), UNO_QUERY_THROW );
644cdf0e10cSrcweir 			if ( xShape->getShapeType() == sOLE2Shape )
645cdf0e10cSrcweir 				nOLECount++;
646cdf0e10cSrcweir 		}
647cdf0e10cSrcweir 	}
648cdf0e10cSrcweir 
649cdf0e10cSrcweir 	std::vector< rtl::OUString > aControlList;
650*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText0Pg2 ), getString( STR_OLE_OPTIMIZATION ), PAGE_POS_X, PAGE_POS_Y, PAGE_WIDTH, 8, sal_False, sal_True, mnTabIndex++ ) );
651*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertCheckBox(  TKGet( TK_CheckBox0Pg2 ), getString( STR_OLE_REPLACE ), HID( HID_SDEXT_MINIMIZER_WIZ_STEP4_CB_OLE ), PAGE_POS_X + 6, PAGE_POS_Y + 14, PAGE_WIDTH - 12, 8, mnTabIndex++ ) );
652*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertRadioButton( TKGet( TK_RadioButton0Pg2 ), getString( STR_ALL_OLE_OBJECTS ), HID(HID_SDEXT_MINIMIZER_WIZ_STEP4_RB_ALLOLE), PAGE_POS_X + 14, PAGE_POS_Y + 28, PAGE_WIDTH - 22, 8, sal_False, mnTabIndex++ ) );
653*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertRadioButton( TKGet( TK_RadioButton1Pg2 ), getString( STR_ALIEN_OLE_OBJECTS_ONLY ), HID(HID_SDEXT_MINIMIZER_WIZ_STEP4_RB_NOTODF),PAGE_POS_X + 14, PAGE_POS_Y + 40, PAGE_WIDTH - 22, 8, sal_False, mnTabIndex++ ) );
654*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText1Pg2 ), nOLECount ? getString( STR_OLE_OBJECTS_DESC ) : getString( STR_NO_OLE_OBJECTS_DESC ), PAGE_POS_X + 6, PAGE_POS_Y + 64, PAGE_WIDTH - 22, 50, sal_True, sal_False, mnTabIndex++ ) );
655cdf0e10cSrcweir 	maControlPages.push_back( aControlList );
656cdf0e10cSrcweir 	DeactivatePage( 3 );
657cdf0e10cSrcweir 	UpdateControlStatesPage3();
658cdf0e10cSrcweir }
659cdf0e10cSrcweir 
660cdf0e10cSrcweir // -----------------------------------------------------------------------------
661cdf0e10cSrcweir 
ImpValueOfInMB(const sal_Int64 & rVal,sal_Unicode nSeparator='.')662cdf0e10cSrcweir static OUString ImpValueOfInMB( const sal_Int64& rVal, sal_Unicode nSeparator = '.' )
663cdf0e10cSrcweir {
664cdf0e10cSrcweir 	double fVal( static_cast<double>( rVal ) );
665cdf0e10cSrcweir 	fVal /= ( 1 << 20 );
666cdf0e10cSrcweir 	fVal += 0.05;
667cdf0e10cSrcweir 	rtl::OUStringBuffer aVal( OUString::valueOf( fVal ) );
668cdf0e10cSrcweir 	sal_Int32 nX( OUString( aVal.getStr() ).indexOf( '.', 0 ) );
669cdf0e10cSrcweir 	if ( nX >= 0 )
670cdf0e10cSrcweir 	{
671cdf0e10cSrcweir 		aVal.setLength( nX + 2 );
672cdf0e10cSrcweir 		aVal.setCharAt( nX, nSeparator );
673cdf0e10cSrcweir 	}
674cdf0e10cSrcweir 	aVal.append( OUString::createFromAscii( " MB" ) );
675cdf0e10cSrcweir 	return aVal.makeStringAndClear();
676cdf0e10cSrcweir }
677cdf0e10cSrcweir 
UpdateControlStatesPage4()678cdf0e10cSrcweir void OptimizerDialog::UpdateControlStatesPage4()
679cdf0e10cSrcweir {
680cdf0e10cSrcweir 	sal_Bool bSaveAs( GetConfigProperty( TK_SaveAs, sal_True ) );
681cdf0e10cSrcweir 	if ( mbIsReadonly )
682cdf0e10cSrcweir 	{
683cdf0e10cSrcweir 		setControlProperty( TKGet( TK_RadioButton0Pg4 ), TKGet( TK_State ), Any( (sal_Int16)( sal_False ) ) );
684cdf0e10cSrcweir 		setControlProperty( TKGet( TK_RadioButton1Pg4 ), TKGet( TK_State ), Any( (sal_Int16)( sal_True ) ) );
685cdf0e10cSrcweir 	}
686cdf0e10cSrcweir 	else
687cdf0e10cSrcweir 	{
688cdf0e10cSrcweir 		setControlProperty( TKGet( TK_RadioButton0Pg4 ), TKGet( TK_State ), Any( (sal_Int16)( bSaveAs == sal_False ) ) );
689cdf0e10cSrcweir 		setControlProperty( TKGet( TK_RadioButton1Pg4 ), TKGet( TK_State ), Any( (sal_Int16)( bSaveAs == sal_True ) ) );
690cdf0e10cSrcweir 	}
691cdf0e10cSrcweir 	setControlProperty( TKGet( TK_ComboBox0Pg4 ), TKGet( TK_Enabled ), Any( sal_False ) );
692cdf0e10cSrcweir 
693cdf0e10cSrcweir 	sal_uInt32 w;
694cdf0e10cSrcweir 	Sequence< OUString > aItemList;
695cdf0e10cSrcweir 	const std::vector< OptimizerSettings >& rList( GetOptimizerSettings() );
696cdf0e10cSrcweir 	if ( rList.size() > 1 )	// the first session in the list is the actual one -> skipping first one
697cdf0e10cSrcweir 	{
698cdf0e10cSrcweir 		aItemList.realloc( rList.size() - 1 );
699cdf0e10cSrcweir 		for ( w = 1; w < rList.size(); w++ )
700cdf0e10cSrcweir 			aItemList[ w - 1 ] = rList[ w ].maName;
701cdf0e10cSrcweir 	}
702cdf0e10cSrcweir 	setControlProperty( TKGet( TK_ComboBox0Pg4 ), TKGet( TK_StringItemList ), Any( aItemList ) );
703cdf0e10cSrcweir 
704cdf0e10cSrcweir 	// now check if it is sensible to enable the combo box
705cdf0e10cSrcweir 	sal_Bool bSaveSettingsEnabled = sal_True;
706cdf0e10cSrcweir 	if ( rList.size() > 1 )	// the first session in the list is the actual one -> skipping first one
707cdf0e10cSrcweir 	{
708cdf0e10cSrcweir 		for ( w = 1; w < rList.size(); w++ )
709cdf0e10cSrcweir 		{
710cdf0e10cSrcweir 			if ( rList[ w ] == rList[ 0 ] )
711cdf0e10cSrcweir 			{
712cdf0e10cSrcweir 				bSaveSettingsEnabled = sal_False;
713cdf0e10cSrcweir 				break;
714cdf0e10cSrcweir 			}
715cdf0e10cSrcweir 		}
716cdf0e10cSrcweir 	}
717cdf0e10cSrcweir 	sal_Int16 nInt16 = 0;
718cdf0e10cSrcweir 	getControlProperty( TKGet( TK_CheckBox1Pg4 ), TKGet( TK_State ) ) >>= nInt16;
719cdf0e10cSrcweir 	setControlProperty( TKGet( TK_CheckBox1Pg4 ), TKGet( TK_Enabled ), Any( bSaveSettingsEnabled ) );
720cdf0e10cSrcweir 	setControlProperty( TKGet( TK_ComboBox0Pg4 ), TKGet( TK_Enabled ), Any( bSaveSettingsEnabled && nInt16 ) );
721cdf0e10cSrcweir 
722cdf0e10cSrcweir 	std::vector< OUString > aSummaryStrings;
723cdf0e10cSrcweir 
724cdf0e10cSrcweir 	// taking care of deleted slides
725cdf0e10cSrcweir 	sal_Int32 nDeletedSlides = 0;
726cdf0e10cSrcweir 	rtl::OUString aCustomShowName;
727cdf0e10cSrcweir 	if ( getControlProperty( TKGet( TK_CheckBox3Pg3 ), TKGet( TK_State ) ) >>= nInt16 )
728cdf0e10cSrcweir 	{
729cdf0e10cSrcweir 		if ( nInt16 )
730cdf0e10cSrcweir 		{
731cdf0e10cSrcweir 			Sequence< short > aSelectedItems;
732cdf0e10cSrcweir 			Sequence< OUString > aStringItemList;
733cdf0e10cSrcweir 			Any aAny = getControlProperty( TKGet( TK_ListBox0Pg3 ), TKGet( TK_SelectedItems ) );
734cdf0e10cSrcweir 			if ( aAny >>= aSelectedItems )
735cdf0e10cSrcweir 			{
736cdf0e10cSrcweir 				if ( aSelectedItems.getLength() )
737cdf0e10cSrcweir 				{
738cdf0e10cSrcweir 					sal_Int16 nSelectedItem = aSelectedItems[ 0 ];
739cdf0e10cSrcweir 					aAny = getControlProperty( TKGet( TK_ListBox0Pg3 ), TKGet( TK_StringItemList ) );
740cdf0e10cSrcweir 					if ( aAny >>= aStringItemList )
741cdf0e10cSrcweir 					{
742cdf0e10cSrcweir 						if ( aStringItemList.getLength() > nSelectedItem )
743cdf0e10cSrcweir 							SetConfigProperty( TK_CustomShowName, Any( aStringItemList[ nSelectedItem ] ) );
744cdf0e10cSrcweir 					}
745cdf0e10cSrcweir 				}
746cdf0e10cSrcweir 			}
747cdf0e10cSrcweir 		}
748cdf0e10cSrcweir 	}
749cdf0e10cSrcweir 	if ( aCustomShowName.getLength() )
750cdf0e10cSrcweir 	{
751cdf0e10cSrcweir 		std::vector< Reference< XDrawPage > > vNonUsedPageList;
752*597a4c59SAriel Constenla-Haile 		PageCollector::CollectNonCustomShowPages( mxModel, aCustomShowName, vNonUsedPageList );
753cdf0e10cSrcweir 		nDeletedSlides += vNonUsedPageList.size();
754cdf0e10cSrcweir 	}
755cdf0e10cSrcweir 	if ( GetConfigProperty( TK_DeleteHiddenSlides, sal_False ) )
756cdf0e10cSrcweir 	{
757cdf0e10cSrcweir 		if ( aCustomShowName.getLength() )
758cdf0e10cSrcweir 		{
759cdf0e10cSrcweir 			std::vector< Reference< XDrawPage > > vUsedPageList;
760*597a4c59SAriel Constenla-Haile 			PageCollector::CollectCustomShowPages( mxModel, aCustomShowName, vUsedPageList );
761cdf0e10cSrcweir 			std::vector< Reference< XDrawPage > >::iterator aIter( vUsedPageList.begin() );
762cdf0e10cSrcweir 			while( aIter != vUsedPageList.end() )
763cdf0e10cSrcweir 			{
764cdf0e10cSrcweir 				Reference< XPropertySet > xPropSet( *aIter, UNO_QUERY_THROW );
765cdf0e10cSrcweir 				sal_Bool bVisible = sal_True;
766cdf0e10cSrcweir 				const OUString sVisible( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) );
767cdf0e10cSrcweir 				if ( xPropSet->getPropertyValue( sVisible ) >>= bVisible )
768cdf0e10cSrcweir 				{
769cdf0e10cSrcweir 					if (!bVisible )
770cdf0e10cSrcweir 						nDeletedSlides++;
771cdf0e10cSrcweir 				}
772cdf0e10cSrcweir 				aIter++;
773cdf0e10cSrcweir 			}
774cdf0e10cSrcweir 		}
775cdf0e10cSrcweir 		else
776cdf0e10cSrcweir 		{
777*597a4c59SAriel Constenla-Haile 			Reference< XDrawPagesSupplier > xDrawPagesSupplier( mxModel, UNO_QUERY_THROW );
778cdf0e10cSrcweir 			Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY_THROW );
779cdf0e10cSrcweir 			for( sal_Int32 i = 0; i < xDrawPages->getCount(); i++ )
780cdf0e10cSrcweir 			{
781cdf0e10cSrcweir 				Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
782cdf0e10cSrcweir 				Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY_THROW );
783cdf0e10cSrcweir 
784cdf0e10cSrcweir 				sal_Bool bVisible = sal_True;
785cdf0e10cSrcweir 				const OUString sVisible( RTL_CONSTASCII_USTRINGPARAM( "Visible" ) );
786cdf0e10cSrcweir 				if ( xPropSet->getPropertyValue( sVisible ) >>= bVisible )
787cdf0e10cSrcweir 				{
788cdf0e10cSrcweir 					if (!bVisible )
789cdf0e10cSrcweir 						nDeletedSlides++;
790cdf0e10cSrcweir 				}
791cdf0e10cSrcweir 			}
792cdf0e10cSrcweir 		}
793cdf0e10cSrcweir 	}
794cdf0e10cSrcweir 	if ( GetConfigProperty( TK_DeleteUnusedMasterPages, sal_False ) )
795cdf0e10cSrcweir 	{
796cdf0e10cSrcweir 		std::vector< PageCollector::MasterPageEntity > aMasterPageList;
797*597a4c59SAriel Constenla-Haile 		PageCollector::CollectMasterPages( mxModel, aMasterPageList );
798*597a4c59SAriel Constenla-Haile 		Reference< XMasterPagesSupplier > xMasterPagesSupplier( mxModel, UNO_QUERY_THROW );
799cdf0e10cSrcweir 		Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_QUERY_THROW );
800cdf0e10cSrcweir 		std::vector< PageCollector::MasterPageEntity >::iterator aIter( aMasterPageList.begin() );
801cdf0e10cSrcweir 		while( aIter != aMasterPageList.end() )
802cdf0e10cSrcweir 		{
803cdf0e10cSrcweir 			if ( !aIter->bUsed )
804cdf0e10cSrcweir 				nDeletedSlides++;
805cdf0e10cSrcweir 			aIter++;
806cdf0e10cSrcweir 		}
807cdf0e10cSrcweir 	}
808cdf0e10cSrcweir 	if ( nDeletedSlides > 1 )
809cdf0e10cSrcweir 	{
810cdf0e10cSrcweir 		OUString aStr( getString( STR_DELETE_SLIDES ) );
811cdf0e10cSrcweir 		OUString aPlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%SLIDES" ) );
812cdf0e10cSrcweir 		sal_Int32 i = aStr.indexOf( aPlaceholder, 0 );
813cdf0e10cSrcweir 		if ( i >= 0 )
814cdf0e10cSrcweir 			aStr = aStr.replaceAt( i, aPlaceholder.getLength(), OUString::valueOf( nDeletedSlides ) );
815cdf0e10cSrcweir 		aSummaryStrings.push_back( aStr );
816cdf0e10cSrcweir 	}
817cdf0e10cSrcweir 
818cdf0e10cSrcweir // generating graphic compression info
819cdf0e10cSrcweir 	sal_Int32 nGraphics = 0;
820cdf0e10cSrcweir 	sal_Bool bJPEGCompression( GetConfigProperty( TK_JPEGCompression, sal_False ) );
821cdf0e10cSrcweir 	sal_Int32 nJPEGQuality( GetConfigProperty( TK_JPEGQuality, (sal_Int32)90 ) );
822cdf0e10cSrcweir 	sal_Int32 nImageResolution( GetConfigProperty( TK_ImageResolution, (sal_Int32)0 ) );
823cdf0e10cSrcweir 	GraphicSettings aGraphicSettings( bJPEGCompression, nJPEGQuality, GetConfigProperty( TK_RemoveCropArea, sal_False ),
824cdf0e10cSrcweir 										nImageResolution, GetConfigProperty( TK_EmbedLinkedGraphics, sal_True ) );
825*597a4c59SAriel Constenla-Haile 	GraphicCollector::CountGraphics( mxContext, mxModel, aGraphicSettings, nGraphics );
826cdf0e10cSrcweir 	if ( nGraphics > 1 )
827cdf0e10cSrcweir 	{
828cdf0e10cSrcweir 		OUString aStr( getString( STR_OPTIMIZE_IMAGES ) );
829cdf0e10cSrcweir 		OUString aImagePlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%IMAGES" ) );
830cdf0e10cSrcweir 		OUString aQualityPlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%QUALITY" ) );
831cdf0e10cSrcweir 		OUString aResolutionPlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%RESOLUTION" ) );
832cdf0e10cSrcweir 		sal_Int32 i = aStr.indexOf( aImagePlaceholder, 0 );
833cdf0e10cSrcweir 		if ( i >= 0 )
834cdf0e10cSrcweir 			aStr = aStr.replaceAt( i, aImagePlaceholder.getLength(), OUString::valueOf( nGraphics ) );
835cdf0e10cSrcweir 
836cdf0e10cSrcweir 		sal_Int32 j = aStr.indexOf( aQualityPlaceholder, 0 );
837cdf0e10cSrcweir 		if ( j >= 0 )
838cdf0e10cSrcweir 			aStr = aStr.replaceAt( j, aQualityPlaceholder.getLength(), OUString::valueOf( nJPEGQuality ) );
839cdf0e10cSrcweir 
840cdf0e10cSrcweir 		sal_Int32 k = aStr.indexOf( aResolutionPlaceholder, 0 );
841cdf0e10cSrcweir 		if ( k >= 0 )
842cdf0e10cSrcweir 			aStr = aStr.replaceAt( k, aResolutionPlaceholder.getLength(), OUString::valueOf( nImageResolution ) );
843cdf0e10cSrcweir 
844cdf0e10cSrcweir 		aSummaryStrings.push_back( aStr );
845cdf0e10cSrcweir 	}
846cdf0e10cSrcweir 
847cdf0e10cSrcweir 	if ( GetConfigProperty( TK_OLEOptimization, sal_False ) )
848cdf0e10cSrcweir 	{
849cdf0e10cSrcweir 		sal_Int32 nOLEReplacements = 0;
850*597a4c59SAriel Constenla-Haile 		Reference< XDrawPagesSupplier > xDrawPagesSupplier( mxModel, UNO_QUERY_THROW );
851cdf0e10cSrcweir 		Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_QUERY_THROW );
852cdf0e10cSrcweir 		for ( sal_Int32 i = 0; i < xDrawPages->getCount(); i++ )
853cdf0e10cSrcweir 		{
854cdf0e10cSrcweir 			Reference< XShapes > xShapes( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
855cdf0e10cSrcweir 			for ( sal_Int32 j = 0; j < xShapes->getCount(); j++ )
856cdf0e10cSrcweir 			{
857cdf0e10cSrcweir 				const OUString sOLE2Shape( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.drawing.OLE2Shape" ) );
858cdf0e10cSrcweir 				Reference< XShape > xShape( xShapes->getByIndex( j ), UNO_QUERY_THROW );
859cdf0e10cSrcweir 				if ( xShape->getShapeType() == sOLE2Shape )
860cdf0e10cSrcweir 					nOLEReplacements++;
861cdf0e10cSrcweir 			}
862cdf0e10cSrcweir 		}
863cdf0e10cSrcweir 		if ( nOLEReplacements > 1 )
864cdf0e10cSrcweir 		{
865cdf0e10cSrcweir 			OUString aStr( getString( STR_CREATE_REPLACEMENT ) );
866cdf0e10cSrcweir 			OUString aPlaceholder( RTL_CONSTASCII_USTRINGPARAM( "%OLE" ) );
867cdf0e10cSrcweir 			sal_Int32 i = aStr.indexOf( aPlaceholder, 0 );
868cdf0e10cSrcweir 			if ( i >= 0 )
869cdf0e10cSrcweir 				aStr = aStr.replaceAt( i, aPlaceholder.getLength(), OUString::valueOf( nOLEReplacements ) );
870cdf0e10cSrcweir 			aSummaryStrings.push_back( aStr );
871cdf0e10cSrcweir 		}
872cdf0e10cSrcweir 	}
873cdf0e10cSrcweir 	while( aSummaryStrings.size() < 3 )
874cdf0e10cSrcweir 		aSummaryStrings.push_back( OUString() );
875cdf0e10cSrcweir 	setControlProperty( TKGet( TK_FixedText4Pg4 ), TKGet( TK_Label ), Any( aSummaryStrings[ 0 ] ) );
876cdf0e10cSrcweir 	setControlProperty( TKGet( TK_FixedText5Pg4 ), TKGet( TK_Label ), Any( aSummaryStrings[ 1 ] ) );
877cdf0e10cSrcweir 	setControlProperty( TKGet( TK_FixedText6Pg4 ), TKGet( TK_Label ), Any( aSummaryStrings[ 2 ] ) );
878cdf0e10cSrcweir 
879cdf0e10cSrcweir 	sal_Int64 nCurrentFileSize = 0;
880cdf0e10cSrcweir 	sal_Int64 nEstimatedFileSize = 0;
881*597a4c59SAriel Constenla-Haile 	Reference< XStorable > xStorable( mxModel, UNO_QUERY );
882cdf0e10cSrcweir 	if ( xStorable.is() && xStorable->hasLocation() )
883cdf0e10cSrcweir 		nCurrentFileSize = PPPOptimizer::GetFileSize( xStorable->getLocation() );
884cdf0e10cSrcweir 
885cdf0e10cSrcweir 	if ( nCurrentFileSize )
886cdf0e10cSrcweir 	{
887cdf0e10cSrcweir 		double fE = static_cast< double >( nCurrentFileSize );
888cdf0e10cSrcweir 		if ( nImageResolution )
889cdf0e10cSrcweir 		{
890cdf0e10cSrcweir 			double v = ( static_cast< double >( nImageResolution ) + 75.0 ) / 300.0;
891cdf0e10cSrcweir 			if ( v < 1.0 )
892cdf0e10cSrcweir 				fE *= v;
893cdf0e10cSrcweir 		}
894cdf0e10cSrcweir 		if ( bJPEGCompression )
895cdf0e10cSrcweir 		{
896cdf0e10cSrcweir 			double v = 0.75 - ( ( 100.0 - static_cast< double >( nJPEGQuality ) ) / 400.0 ) ;
897cdf0e10cSrcweir 			fE *= v;
898cdf0e10cSrcweir 		}
899cdf0e10cSrcweir 		nEstimatedFileSize = static_cast< sal_Int64 >( fE );
900cdf0e10cSrcweir 	}
901cdf0e10cSrcweir 	sal_Unicode nSeparator = '.';
902cdf0e10cSrcweir 	OUString aStr( getString( STR_FILESIZESEPARATOR ) );
903cdf0e10cSrcweir 	if ( aStr.getLength() )
904cdf0e10cSrcweir 		nSeparator = aStr[ 0 ];
905cdf0e10cSrcweir 	setControlProperty( TKGet( TK_FixedText7Pg4 ), TKGet( TK_Label ), Any( ImpValueOfInMB( nCurrentFileSize, nSeparator ) ) );
906cdf0e10cSrcweir 	setControlProperty( TKGet( TK_FixedText8Pg4 ), TKGet( TK_Label ), Any( ImpValueOfInMB( nEstimatedFileSize, nSeparator ) ) );
907cdf0e10cSrcweir 	SetConfigProperty( TK_EstimatedFileSize, Any( nEstimatedFileSize ) );
908cdf0e10cSrcweir }
909cdf0e10cSrcweir 
InitPage4()910cdf0e10cSrcweir void OptimizerDialog::InitPage4()
911cdf0e10cSrcweir {
912cdf0e10cSrcweir 	{	// creating progress bar:
913cdf0e10cSrcweir 		OUString pNames[] = {
914cdf0e10cSrcweir 			TKGet( TK_Height ),
915cdf0e10cSrcweir 			TKGet( TK_Name ),
916cdf0e10cSrcweir 			TKGet( TK_PositionX ),
917cdf0e10cSrcweir 			TKGet( TK_PositionY ),
918cdf0e10cSrcweir 			TKGet( TK_ProgressValue ),
919cdf0e10cSrcweir 			TKGet( TK_ProgressValueMax ),
920cdf0e10cSrcweir 			TKGet( TK_ProgressValueMin ),
921cdf0e10cSrcweir 			TKGet( TK_Width ) };
922cdf0e10cSrcweir 
923cdf0e10cSrcweir 		Any	pValues[] = {
924cdf0e10cSrcweir 			Any( (sal_Int32)12 ),
925*597a4c59SAriel Constenla-Haile 			Any( OUString( RTL_CONSTASCII_USTRINGPARAM("STR_SAVE_AS") ) ),//TODO
926cdf0e10cSrcweir 			Any( (sal_Int32)( PAGE_POS_X + 6 ) ),
927cdf0e10cSrcweir 			Any( (sal_Int32)( DIALOG_HEIGHT - 75 ) ),
928cdf0e10cSrcweir 			Any( (sal_Int32)( 0 ) ),
929cdf0e10cSrcweir 			Any( (sal_Int32)( 100 ) ),
930cdf0e10cSrcweir 			Any( (sal_Int32)( 0 ) ),
931cdf0e10cSrcweir 			Any( (sal_Int32)( PAGE_WIDTH - 12 ) ) };
932cdf0e10cSrcweir 
933cdf0e10cSrcweir 		sal_Int32 nCount = sizeof( pNames ) / sizeof( OUString );
934cdf0e10cSrcweir 
935cdf0e10cSrcweir 		Sequence< rtl::OUString >	aNames( pNames, nCount );
936cdf0e10cSrcweir 		Sequence< Any >				aValues( pValues, nCount );
937cdf0e10cSrcweir 
938cdf0e10cSrcweir 		Reference< XMultiPropertySet > xMultiPropertySet( insertControlModel( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.UnoControlProgressBarModel" ) ),
939cdf0e10cSrcweir 			TKGet( TK_Progress ), aNames, aValues ), UNO_QUERY );
940cdf0e10cSrcweir 	}
941*597a4c59SAriel Constenla-Haile 
942cdf0e10cSrcweir 	Sequence< OUString > aItemList;
943cdf0e10cSrcweir 	std::vector< rtl::OUString > aControlList;
944*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText0Pg4 ), getString( STR_SUMMARY_TITLE ), PAGE_POS_X, PAGE_POS_Y, PAGE_WIDTH, 8, sal_False, sal_True, mnTabIndex++ ) );
945*597a4c59SAriel Constenla-Haile //	aControlList.push_back( ImplInsertSeparator( TKGet( TK_Separator0Pg4 ), 0, PAGE_POS_X + 6, PAGE_POS_Y + 90, PAGE_WIDTH - 12, 1 ) );
946cdf0e10cSrcweir 
947*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText4Pg4 ), OUString(), PAGE_POS_X + 6, PAGE_POS_Y + 14, PAGE_WIDTH - 12, 8, sal_False, sal_False, mnTabIndex++ ) );
948*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText5Pg4 ), OUString(), PAGE_POS_X + 6, PAGE_POS_Y + 22, PAGE_WIDTH - 12, 8, sal_False, sal_False, mnTabIndex++ ) );
949*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText6Pg4 ), OUString(), PAGE_POS_X + 6, PAGE_POS_Y + 30, PAGE_WIDTH - 12, 8, sal_False, sal_False, mnTabIndex++ ) );
950cdf0e10cSrcweir 
951*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText2Pg4 ), getString( STR_CURRENT_FILESIZE ), PAGE_POS_X + 6, PAGE_POS_Y + 50, 88, 8, sal_False, sal_False, mnTabIndex++ ) );
952*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText7Pg4 ), OUString(), PAGE_POS_X + 100, PAGE_POS_Y + 50, 30, 8, sal_False, sal_False, mnTabIndex++ ) );
953cdf0e10cSrcweir 	setControlProperty( TKGet( TK_FixedText7Pg4 ), TKGet( TK_Align ), Any( static_cast< short >( 2 ) ) );
954*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText3Pg4 ), getString( STR_ESTIMATED_FILESIZE ), PAGE_POS_X + 6, PAGE_POS_Y + 58, 88, 8, sal_False, sal_False, mnTabIndex++ ) );
955*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText8Pg4 ), OUString(), PAGE_POS_X + 100, PAGE_POS_Y + 58, 30, 8, sal_False, sal_False, mnTabIndex++ ) );
956cdf0e10cSrcweir 	setControlProperty( TKGet( TK_FixedText8Pg4 ), TKGet( TK_Align ), Any( static_cast< short >( 2 ) ) );
957cdf0e10cSrcweir 
958*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertRadioButton( TKGet( TK_RadioButton0Pg4 ), getString(  STR_APPLY_TO_CURRENT ), HID(HID_SDEXT_MINIMIZER_WIZ_STEP5_RB_CURDOC),PAGE_POS_X + 6, PAGE_POS_Y + 78, PAGE_WIDTH - 12, 8, sal_False, mnTabIndex++ ) );
959*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertRadioButton( TKGet( TK_RadioButton1Pg4 ), getString( STR_SAVE_AS ), HID(HID_SDEXT_MINIMIZER_WIZ_STEP5_RB_NEWDOC),PAGE_POS_X + 6, PAGE_POS_Y + 90, PAGE_WIDTH - 12, 8, sal_False, mnTabIndex++ ) );
960*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertFixedText( TKGet( TK_FixedText1Pg4 ), OUString(), PAGE_POS_X + 6, DIALOG_HEIGHT - 87, PAGE_WIDTH - 12, 8, sal_True, sal_False, mnTabIndex++ ) );
961cdf0e10cSrcweir 	aControlList.push_back( TKGet( TK_Progress ) );
962*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertSeparator( TKGet( TK_Separator1Pg4 ), 0, PAGE_POS_X + 6, DIALOG_HEIGHT - 58, PAGE_WIDTH - 12, 1 ) );
963*597a4c59SAriel Constenla-Haile 	aControlList.push_back( ImplInsertCheckBox(  TKGet( TK_CheckBox1Pg4 ), getString( STR_SAVE_SETTINGS ), HID( HID_SDEXT_MINIMIZER_WIZ_STEP5_CB_SAVESETTINGS ), PAGE_POS_X + 6, DIALOG_HEIGHT - 47, 100, 8, mnTabIndex++ ) );
964*597a4c59SAriel Constenla-Haile     // don't listen to this
965*597a4c59SAriel Constenla-Haile 	aControlList.push_back(
966*597a4c59SAriel Constenla-Haile         ImplInsertComboBox(
967*597a4c59SAriel Constenla-Haile             TKGet( TK_ComboBox0Pg4 ),  HID( HID_SDEXT_MINIMIZER_WIZ_STEP5_LB_SETTINGSNAME ),sal_True, aItemList,
968*597a4c59SAriel Constenla-Haile             PAGE_POS_X + 106, DIALOG_HEIGHT - 48, 100, 12, mnTabIndex++ ,
969*597a4c59SAriel Constenla-Haile             false) );
970cdf0e10cSrcweir 	maControlPages.push_back( aControlList );
971cdf0e10cSrcweir 	DeactivatePage( 4 );
972cdf0e10cSrcweir 
973cdf0e10cSrcweir 	// creating a default session name that hasn't been used yet
974cdf0e10cSrcweir 	OUString aSettingsName;
975cdf0e10cSrcweir 	OUString aDefault( getString( STR_MY_SETTINGS ) );
976cdf0e10cSrcweir 	sal_Int32 nSession = 1;
977cdf0e10cSrcweir 	sal_uInt32 i;
978cdf0e10cSrcweir 	const std::vector< OptimizerSettings >& rList( GetOptimizerSettings() );
979cdf0e10cSrcweir 	do
980cdf0e10cSrcweir 	{
981cdf0e10cSrcweir 		OUString aTemp( aDefault.concat( OUString::valueOf( nSession++ ) ) );
982cdf0e10cSrcweir 		for ( i = 1; i < rList.size(); i++ )
983cdf0e10cSrcweir 		{
984cdf0e10cSrcweir 			if ( rList[ i ].maName == aTemp )
985cdf0e10cSrcweir 				break;
986cdf0e10cSrcweir 		}
987cdf0e10cSrcweir 		if ( i == rList.size() )
988cdf0e10cSrcweir 			aSettingsName = aTemp;
989cdf0e10cSrcweir 	}
990cdf0e10cSrcweir 	while( !aSettingsName.getLength() );
991cdf0e10cSrcweir 
992cdf0e10cSrcweir 	setControlProperty( TKGet( TK_ComboBox0Pg4 ), TKGet( TK_Text ), Any( aSettingsName ) );
993cdf0e10cSrcweir 	setControlProperty( TKGet( TK_RadioButton0Pg4 ), TKGet( TK_Enabled ), Any( !mbIsReadonly ) );
994cdf0e10cSrcweir 	setControlProperty( TKGet( TK_RadioButton1Pg4 ), TKGet( TK_Enabled ), Any( !mbIsReadonly ) );
995cdf0e10cSrcweir 
996cdf0e10cSrcweir 	UpdateControlStatesPage4();
997cdf0e10cSrcweir }
998cdf0e10cSrcweir 
999cdf0e10cSrcweir // -----------------------------------------------------------------------------
EnablePage(sal_Int16 nStep)1000cdf0e10cSrcweir void OptimizerDialog::EnablePage( sal_Int16 nStep )
1001cdf0e10cSrcweir {
1002cdf0e10cSrcweir 	std::vector< rtl::OUString >::iterator aBeg( maControlPages[ nStep ].begin() );
1003cdf0e10cSrcweir 	std::vector< rtl::OUString >::iterator aEnd( maControlPages[ nStep ].end() );
1004cdf0e10cSrcweir 	while( aBeg != aEnd )
1005cdf0e10cSrcweir 		setControlProperty( *aBeg++, TKGet( TK_Enabled ), Any( sal_True ) );
1006cdf0e10cSrcweir }
DisablePage(sal_Int16 nStep)1007cdf0e10cSrcweir void OptimizerDialog::DisablePage( sal_Int16 nStep )
1008cdf0e10cSrcweir {
1009cdf0e10cSrcweir 	std::vector< rtl::OUString >::iterator aBeg( maControlPages[ nStep ].begin() );
1010cdf0e10cSrcweir 	std::vector< rtl::OUString >::iterator aEnd( maControlPages[ nStep ].end() );
1011cdf0e10cSrcweir 	while( aBeg != aEnd )
1012cdf0e10cSrcweir 		setControlProperty( *aBeg++, TKGet( TK_Enabled ), Any( sal_False ) );
1013cdf0e10cSrcweir }
ActivatePage(sal_Int16 nStep)1014cdf0e10cSrcweir void OptimizerDialog::ActivatePage( sal_Int16 nStep )
1015cdf0e10cSrcweir {
1016cdf0e10cSrcweir 	std::vector< rtl::OUString >::iterator aBeg( maControlPages[ nStep ].begin() );
1017cdf0e10cSrcweir 	std::vector< rtl::OUString >::iterator aEnd( maControlPages[ nStep ].end() );
1018cdf0e10cSrcweir 	while( aBeg != aEnd )
1019cdf0e10cSrcweir 		setVisible( *aBeg++, sal_True );
1020cdf0e10cSrcweir }
DeactivatePage(sal_Int16 nStep)1021cdf0e10cSrcweir void OptimizerDialog::DeactivatePage( sal_Int16 nStep )
1022cdf0e10cSrcweir {
1023cdf0e10cSrcweir 	std::vector< rtl::OUString >::iterator aBeg( maControlPages[ nStep ].begin() );
1024cdf0e10cSrcweir 	std::vector< rtl::OUString >::iterator aEnd( maControlPages[ nStep ].end() );
1025cdf0e10cSrcweir 	while( aBeg != aEnd )
1026cdf0e10cSrcweir 		setVisible( *aBeg++, sal_False );
1027cdf0e10cSrcweir }
1028