vcl: allow for overriding the default PDF rendering resolution
[LibreOffice.git] / sdext / source / minimizer / optimizerdialogcontrols.cxx
blobef193b85a4a5e14d39a8d966222a6cd30e7aee9f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
21 #include "optimizerdialog.hxx"
24 #include "pppoptimizer.hxx"
25 #include "graphiccollector.hxx"
26 #include "pagecollector.hxx"
27 #include <com/sun/star/awt/PushButtonType.hpp>
28 #include <com/sun/star/awt/XSpinField.hpp>
29 #include <com/sun/star/awt/XTextComponent.hpp>
30 #include <com/sun/star/presentation/XCustomPresentationSupplier.hpp>
31 #include <com/sun/star/drawing/XMasterPagesSupplier.hpp>
32 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
33 #include <com/sun/star/awt/FontDescriptor.hpp>
34 #include <com/sun/star/awt/FontWeight.hpp>
35 #include <com/sun/star/frame/XStorable.hpp>
36 #include <rtl/ustrbuf.hxx>
37 #include <sal/macros.h>
39 using namespace ::com::sun::star::awt;
40 using namespace ::com::sun::star::uno;
41 using namespace ::com::sun::star::util;
42 using namespace ::com::sun::star::lang;
43 using namespace ::com::sun::star::frame;
44 using namespace ::com::sun::star::beans;
45 using namespace ::com::sun::star::drawing;
46 using namespace ::com::sun::star::container;
47 using namespace ::com::sun::star::presentation;
50 static void SetBold( OptimizerDialog& rOptimizerDialog, const OUString& rControl )
52 FontDescriptor aFontDescriptor;
53 if ( rOptimizerDialog.getControlProperty( rControl, "FontDescriptor" ) >>= aFontDescriptor )
55 aFontDescriptor.Weight = com::sun::star::awt::FontWeight::BOLD;
56 rOptimizerDialog.setControlProperty( rControl, "FontDescriptor", Any( aFontDescriptor ) );
61 static OUString InsertSeparator( OptimizerDialog& rOptimizerDialog, const OUString& rControlName, sal_Int32 nOrientation,
62 sal_Int32 nPosX, sal_Int32 nPosY, sal_Int32 nWidth, sal_Int32 nHeight )
64 OUString pNames[] = {
65 OUString("Height"),
66 OUString("Orientation"),
67 OUString("PositionX"),
68 OUString("PositionY"),
69 OUString("Step"),
70 OUString("Width") };
72 Any pValues[] = {
73 Any( nHeight ),
74 Any( nOrientation ),
75 Any( nPosX ),
76 Any( nPosY ),
77 Any( sal_Int16( 0 ) ),
78 Any( nWidth ) };
80 sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
82 Sequence< OUString > aNames( pNames, nCount );
83 Sequence< Any > aValues( pValues, nCount );
85 rOptimizerDialog.insertControlModel( "com.sun.star.awt.UnoControlFixedLineModel",
86 rControlName, aNames, aValues );
87 return rControlName;
91 static OUString InsertButton( OptimizerDialog& rOptimizerDialog, const OUString& rControlName, Reference< XActionListener > const & xActionListener,
92 sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int16 nTabIndex, bool bEnabled, PPPOptimizerTokenEnum nResID, css::awt::PushButtonType nPushButtonType )
94 sal_Int32 nHeight = BUTTON_HEIGHT;
95 OUString pNames[] = {
96 OUString("Enabled"),
97 OUString("Height"),
98 OUString("Label"),
99 OUString("PositionX"),
100 OUString("PositionY"),
101 OUString("PushButtonType"),
102 OUString("Step"),
103 OUString("TabIndex"),
104 OUString("Width") };
106 Any pValues[] = {
107 Any( bEnabled ),
108 Any( nHeight ),
109 Any( rOptimizerDialog.getString( nResID ) ),
110 Any( nXPos ),
111 Any( nYPos ),
112 Any( static_cast< sal_Int16 >(nPushButtonType) ),
113 Any( sal_Int16(0) ),
114 Any( nTabIndex ),
115 Any( nWidth ) };
118 sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
120 Sequence< OUString > aNames( pNames, nCount );
121 Sequence< Any > aValues( pValues, nCount );
123 rOptimizerDialog.insertButton( rControlName, xActionListener, aNames, aValues );
124 return rControlName;
128 static OUString InsertFixedText( OptimizerDialog& rOptimizerDialog, const OUString& rControlName, const OUString& rLabel,
129 sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int32 nHeight, bool bMultiLine, bool bBold, sal_Int16 nTabIndex )
131 OUString pNames[] = {
132 OUString("Height"),
133 OUString("Label"),
134 OUString("MultiLine"),
135 OUString("PositionX"),
136 OUString("PositionY"),
137 OUString("Step"),
138 OUString("TabIndex"),
139 OUString("Width") };
141 Any pValues[] = {
142 Any( nHeight ),
143 Any( rLabel ),
144 Any( bMultiLine ),
145 Any( nXPos ),
146 Any( nYPos ),
147 Any( sal_Int16(0) ),
148 Any( nTabIndex ),
149 Any( nWidth ) };
151 sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
153 Sequence< OUString > aNames( pNames, nCount );
154 Sequence< Any > aValues( pValues, nCount );
156 rOptimizerDialog.insertFixedText( rControlName, aNames, aValues );
157 if ( bBold )
158 SetBold( rOptimizerDialog, rControlName );
159 return rControlName;
163 static OUString InsertCheckBox( OptimizerDialog& rOptimizerDialog, const OUString& rControlName,
164 const Reference< XItemListener >& xItemListener, const OUString& rLabel,
165 sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int16 nTabIndex )
167 sal_Int32 nHeight = 8;
168 OUString pNames[] = {
169 OUString("Enabled"),
170 OUString("Height"),
171 OUString("Label"),
172 OUString("PositionX"),
173 OUString("PositionY"),
174 OUString("Step"),
175 OUString("TabIndex"),
176 OUString("Width") };
178 Any pValues[] = {
179 Any( true ),
180 Any( nHeight ),
181 Any( rLabel ),
182 Any( nXPos ),
183 Any( nYPos ),
184 Any( sal_Int16(0) ),
185 Any( nTabIndex ),
186 Any( nWidth ) };
188 sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
190 Sequence< OUString > aNames( pNames, nCount );
191 Sequence< Any > aValues( pValues, nCount );
193 Reference< XCheckBox > xCheckBox( rOptimizerDialog.insertCheckBox( rControlName, aNames, aValues ) );
194 if ( xItemListener.is() )
195 xCheckBox->addItemListener( xItemListener );
196 return rControlName;
200 static OUString InsertFormattedField( OptimizerDialog& rOptimizerDialog, const OUString& rControlName,
201 const Reference< XTextListener >& xTextListener, const Reference< XSpinListener >& xSpinListener, sal_Int32 nXPos, sal_Int32 nYPos,
202 double fEffectiveMin, double fEffectiveMax, sal_Int16 nTabIndex )
204 sal_Int32 nWidth = 50;
205 OUString pNames[] = {
206 OUString("EffectiveMax"),
207 OUString("EffectiveMin"),
208 OUString("Enabled"),
209 OUString("Height"),
210 OUString("PositionX"),
211 OUString("PositionY"),
212 OUString("Repeat"),
213 OUString("Spin"),
214 OUString("Step"),
215 OUString("TabIndex"),
216 OUString("Width") };
218 Any pValues[] = {
219 Any( fEffectiveMax ),
220 Any( fEffectiveMin ),
221 Any( true ),
222 Any( sal_Int32(12) ),
223 Any( nXPos ),
224 Any( nYPos ),
225 Any( true ),
226 Any( true ),
227 Any( sal_Int16(0) ),
228 Any( nTabIndex ),
229 Any( nWidth ) };
231 sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
233 Sequence< OUString > aNames( pNames, nCount );
234 Sequence< Any > aValues( pValues, nCount );
236 Reference< XTextComponent > xTextComponent( rOptimizerDialog.insertFormattedField( rControlName, aNames, aValues ), UNO_QUERY_THROW );
237 if ( xTextListener.is() )
238 xTextComponent->addTextListener( xTextListener );
239 if ( xSpinListener.is() )
241 Reference< XSpinField > xSpinField( xTextComponent, UNO_QUERY_THROW );
242 xSpinField->addSpinListener( xSpinListener );
244 return rControlName;
248 static OUString InsertComboBox( OptimizerDialog& rOptimizerDialog, const OUString& rControlName,
249 const Reference< XTextListener >& rTextListener, const bool bEnabled, const Sequence< OUString >& rItemList,
250 sal_Int32 nXPos, sal_Int32 nYPos, sal_Int16 nTabIndex )
252 sal_Int32 nHeight = 12;
253 sal_Int32 nWidth = 100;
254 OUString pNames[] = {
255 OUString("Dropdown"),
256 OUString("Enabled"),
257 OUString("Height"),
258 OUString("LineCount"),
259 OUString("PositionX"),
260 OUString("PositionY"),
261 OUString("Step"),
262 OUString("StringItemList"),
263 OUString("TabIndex"),
264 OUString("Width") };
266 Any pValues[] = {
267 Any( true ),
268 Any( bEnabled ),
269 Any( nHeight ),
270 Any( sal_Int16(8)),
271 Any( nXPos ),
272 Any( nYPos ),
273 Any( sal_Int16(0) ),
274 Any( rItemList ),
275 Any( nTabIndex ),
276 Any( nWidth ) };
278 sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
280 Sequence< OUString > aNames( pNames, nCount );
281 Sequence< Any > aValues( pValues, nCount );
283 Reference< XTextComponent > xTextComponent( rOptimizerDialog.insertComboBox( rControlName, aNames, aValues ), UNO_QUERY_THROW );
284 if ( rTextListener.is() )
285 xTextComponent->addTextListener( rTextListener );
286 return rControlName;
290 static OUString InsertRadioButton( OptimizerDialog& rOptimizerDialog, const OUString& rControlName, const Reference< XItemListener >& rItemListener,
291 const OUString& rLabel, sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int16 nTabIndex )
293 sal_Int32 nHeight = 8;
294 OUString pNames[] = {
295 OUString("Height"),
296 OUString("Label"),
297 OUString("MultiLine"),
298 OUString("PositionX"),
299 OUString("PositionY"),
300 OUString("Step"),
301 OUString("TabIndex"),
302 OUString("Width") };
304 Any pValues[] = {
305 Any( nHeight ),
306 Any( rLabel ),
307 Any( false ), // bMultiLine
308 Any( nXPos ),
309 Any( nYPos ),
310 Any( sal_Int16(0) ),
311 Any( nTabIndex ),
312 Any( nWidth ) };
314 sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
316 Sequence< OUString > aNames( pNames, nCount );
317 Sequence< Any > aValues( pValues, nCount );
319 Reference< XRadioButton > xRadioButton( rOptimizerDialog.insertRadioButton( rControlName, aNames, aValues ) );
320 if ( rItemListener.is() )
321 xRadioButton->addItemListener( rItemListener );
322 return rControlName;
326 static OUString InsertListBox( OptimizerDialog& rOptimizerDialog, const OUString& rControlName,
327 const Reference< XActionListener >& rActionListener, const bool bEnabled, const Sequence< OUString >& rItemList,
328 sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int16 nTabIndex )
330 sal_Int32 nHeight = 12;
331 OUString pNames[] = {
332 OUString("Dropdown"),
333 OUString("Enabled"),
334 OUString("Height"),
335 OUString("LineCount"),
336 OUString("MultiSelection"),
337 OUString("PositionX"),
338 OUString("PositionY"),
339 OUString("Step"),
340 OUString("StringItemList"),
341 OUString("TabIndex"),
342 OUString("Width") };
344 Any pValues[] = {
345 Any( true ),
346 Any( bEnabled ),
347 Any( nHeight ),
348 Any( sal_Int16(8)),
349 Any( false ),
350 Any( nXPos ),
351 Any( nYPos ),
352 Any( sal_Int16(0) ),
353 Any( rItemList ),
354 Any( nTabIndex ),
355 Any( nWidth ) };
357 sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
359 Sequence< OUString > aNames( pNames, nCount );
360 Sequence< Any > aValues( pValues, nCount );
362 Reference< XListBox > xListBox( rOptimizerDialog.insertListBox( rControlName, aNames, aValues ) );
363 if ( xListBox.is() )
364 xListBox->addActionListener( rActionListener );
365 return rControlName;
369 void OptimizerDialog::InitNavigationBar()
371 sal_Int32 nCancelPosX = OD_DIALOG_WIDTH - BUTTON_WIDTH - 6;
372 sal_Int32 nFinishPosX = nCancelPosX - 6 - BUTTON_WIDTH;
373 sal_Int32 nNextPosX = nFinishPosX - 6 - BUTTON_WIDTH;
374 sal_Int32 nBackPosX = nNextPosX - 3 - BUTTON_WIDTH;
376 InsertSeparator( *this, "lnNavSep1", 0, 0, DIALOG_HEIGHT - 26, OD_DIALOG_WIDTH, 1 );
377 InsertSeparator( *this, "lnNavSep2", 1, 85, 0, 1, BUTTON_POS_Y - 6 );
379 InsertButton( *this, "btnNavBack", mxActionListener, nBackPosX, BUTTON_POS_Y, BUTTON_WIDTH, mnTabIndex++, false, STR_BACK, PushButtonType_STANDARD );
380 InsertButton( *this, "btnNavNext", mxActionListener, nNextPosX, BUTTON_POS_Y, BUTTON_WIDTH, mnTabIndex++, true, STR_NEXT, PushButtonType_STANDARD );
381 InsertButton( *this, "btnNavFinish", mxActionListener, nFinishPosX, BUTTON_POS_Y, BUTTON_WIDTH, mnTabIndex++, true, STR_FINISH, PushButtonType_STANDARD );
382 InsertButton( *this, "btnNavCancel", mxActionListener, nCancelPosX, BUTTON_POS_Y, BUTTON_WIDTH, mnTabIndex++, true, STR_CANCEL, PushButtonType_STANDARD );
384 setControlProperty( "btnNavNext", "DefaultButton", Any( true ) );
388 void OptimizerDialog::UpdateControlStatesPage0()
390 short nSelectedItem = -1;
391 Sequence< OUString > aItemList;
392 const std::vector< OptimizerSettings >& rList( GetOptimizerSettings() );
393 if ( rList.size() > 1 ) // the first session in the list is the actual one -> skipping first one
395 aItemList.realloc( rList.size() - 1 );
396 for ( std::vector<OptimizerSettings>::size_type i = 1; i < rList.size(); i++ )
398 aItemList[ i - 1 ] = rList[ i ].maName;
399 if ( nSelectedItem < 0 )
401 if ( rList[ i ] == rList[ 0 ] )
402 nSelectedItem = static_cast< short >( i - 1 );
406 bool bRemoveButtonEnabled = false;
407 Sequence< short > aSelectedItems;
408 if ( nSelectedItem >= 0 )
410 aSelectedItems.realloc( 1 );
411 aSelectedItems[ 0 ] = nSelectedItem;
412 if ( nSelectedItem > 2 ) // only allowing to delete custom themes, the first can|t be deleted
413 bRemoveButtonEnabled = true;
415 setControlProperty( "ListBox0Pg0", "StringItemList", Any( aItemList ) );
416 setControlProperty( "ListBox0Pg0", "SelectedItems", Any( aSelectedItems ) );
417 setControlProperty( "Button0Pg0", "Enabled", Any( bRemoveButtonEnabled ) );
419 void OptimizerDialog::InitPage0()
421 Sequence< OUString > aItemList;
422 std::vector< OUString > aControlList;
423 aControlList.push_back( InsertFixedText( *this, "FixedText0Pg0", getString( STR_INTRODUCTION ), PAGE_POS_X, PAGE_POS_Y, PAGE_WIDTH, 8, false, true, mnTabIndex++ ) );
424 aControlList.push_back( InsertFixedText( *this, "FixedText1Pg0", getString( STR_INTRODUCTION_T ), PAGE_POS_X + 6, PAGE_POS_Y + 14, PAGE_WIDTH - 12, 100, true, false, mnTabIndex++ ) );
425 aControlList.push_back( InsertSeparator( *this, "Separator1Pg0", 0, PAGE_POS_X + 6, DIALOG_HEIGHT - 66, PAGE_WIDTH - 12, 1 ) );
426 aControlList.push_back( InsertFixedText( *this, "FixedText2Pg0", getString( STR_CHOSE_SETTINGS ), PAGE_POS_X + 6, DIALOG_HEIGHT - 60, PAGE_WIDTH - 12, 8, true, false, mnTabIndex++ ) );
427 aControlList.push_back( InsertListBox( *this, "ListBox0Pg0", mxActionListenerListBox0Pg0, true, aItemList, PAGE_POS_X + 6, DIALOG_HEIGHT - 48, ( OD_DIALOG_WIDTH - 50 ) - ( PAGE_POS_X + 6 ), mnTabIndex++ ) );
428 aControlList.push_back( InsertButton( *this, "Button0Pg0", mxActionListener, OD_DIALOG_WIDTH - 46, DIALOG_HEIGHT - 49, 40, mnTabIndex++, true, STR_REMOVE, PushButtonType_STANDARD ) );
429 maControlPages.push_back( aControlList );
430 DeactivatePage( 0 );
431 UpdateControlStatesPage0();
435 void OptimizerDialog::UpdateControlStatesPage1()
437 bool bDeleteUnusedMasterPages( GetConfigProperty( TK_DeleteUnusedMasterPages, false ) );
438 bool bDeleteHiddenSlides( GetConfigProperty( TK_DeleteHiddenSlides, false ) );
439 bool bDeleteNotesPages( GetConfigProperty( TK_DeleteNotesPages, false ) );
441 setControlProperty( "CheckBox0Pg3", "State", Any( static_cast<sal_Int16>(bDeleteUnusedMasterPages) ) );
442 setControlProperty( "CheckBox1Pg3", "State", Any( static_cast<sal_Int16>(bDeleteNotesPages) ) );
443 setControlProperty( "CheckBox2Pg3", "State", Any( static_cast<sal_Int16>(bDeleteHiddenSlides) ) );
445 void OptimizerDialog::InitPage1()
447 Sequence< OUString > aCustomShowList;
448 Reference< XModel > xModel( mxController->getModel() );
449 if ( xModel.is() )
451 Reference< XCustomPresentationSupplier > aXCPSup( xModel, UNO_QUERY_THROW );
452 Reference< XNameContainer > aXCont( aXCPSup->getCustomPresentations() );
453 if ( aXCont.is() )
454 aCustomShowList = aXCont->getElementNames();
456 std::vector< OUString > aControlList;
457 aControlList.push_back( InsertFixedText( *this, "FixedText0Pg3", getString( STR_CHOOSE_SLIDES ), PAGE_POS_X, PAGE_POS_Y, PAGE_WIDTH, 8, false, true, mnTabIndex++ ) );
458 aControlList.push_back( InsertCheckBox( *this, "CheckBox0Pg3", mxItemListener, getString( STR_DELETE_MASTER_PAGES ), PAGE_POS_X + 6, PAGE_POS_Y + 14, PAGE_WIDTH - 12, mnTabIndex++ ) );
459 aControlList.push_back( InsertCheckBox( *this, "CheckBox2Pg3", mxItemListener, getString( STR_DELETE_HIDDEN_SLIDES ), PAGE_POS_X + 6, PAGE_POS_Y + 28, PAGE_WIDTH - 12, mnTabIndex++ ) );
460 aControlList.push_back( InsertCheckBox( *this, "CheckBox3Pg3", mxItemListener, getString( STR_CUSTOM_SHOW ), PAGE_POS_X + 6, PAGE_POS_Y + 42, PAGE_WIDTH - 12, mnTabIndex++ ) );
461 aControlList.push_back( InsertListBox( *this, "ListBox0Pg3", mxActionListener, true, aCustomShowList, PAGE_POS_X + 14, PAGE_POS_Y + 54, 150, mnTabIndex++ ) );
462 aControlList.push_back( InsertCheckBox( *this, "CheckBox1Pg3", mxItemListener, getString( STR_DELETE_NOTES_PAGES ), PAGE_POS_X + 6, PAGE_POS_Y + 70, PAGE_WIDTH - 12, mnTabIndex++ ) );
463 maControlPages.push_back( aControlList );
464 DeactivatePage( 1 );
466 setControlProperty( "CheckBox3Pg3", "State", Any( false ) );
467 setControlProperty( "CheckBox3Pg3", "Enabled", Any( aCustomShowList.hasElements() ) );
468 setControlProperty( "ListBox0Pg3", "Enabled", Any( false ) );
470 UpdateControlStatesPage1();
473 namespace
476 bool lcl_getResolutionText(OUString& rResolutionText, const OUString& rImageResolution, sal_Int32 nTargetRes)
478 sal_Int32 nIdx{ 0 };
479 if (rImageResolution.getToken(0, ';', nIdx).toInt32()!=nTargetRes)
480 return false;
481 rResolutionText = rImageResolution.getToken(0, ';', nIdx);
482 return true;
487 void OptimizerDialog::UpdateControlStatesPage2()
489 bool bJPEGCompression( GetConfigProperty( TK_JPEGCompression, false ) );
490 bool bRemoveCropArea( GetConfigProperty( TK_RemoveCropArea, false ) );
491 bool bEmbedLinkedGraphics( GetConfigProperty( TK_EmbedLinkedGraphics, true ) );
492 sal_Int32 nJPEGQuality( GetConfigProperty( TK_JPEGQuality, sal_Int32(90) ) );
494 sal_Int32 nImageResolution( GetConfigProperty( TK_ImageResolution, sal_Int32(0) ) );
496 OUString aResolutionText;
497 for (int nIR{ STR_IMAGE_RESOLUTION_0 }; nIR<=STR_IMAGE_RESOLUTION_3; ++nIR)
499 if (lcl_getResolutionText(aResolutionText, getString(static_cast<PPPOptimizerTokenEnum>(nIR)), nImageResolution))
500 break;
502 if ( aResolutionText.isEmpty() )
503 aResolutionText = OUString::number( nImageResolution );
505 setControlProperty( "RadioButton0Pg1", "State", Any( static_cast<sal_Int16>( !bJPEGCompression ) ) );
506 setControlProperty( "RadioButton1Pg1", "State", Any( static_cast<sal_Int16>(bJPEGCompression) ) );
507 setControlProperty( "FixedText1Pg1", "Enabled", Any( bJPEGCompression ) );
508 setControlProperty( "FormattedField0Pg1", "Enabled", Any( bJPEGCompression ) );
509 setControlProperty( "FormattedField0Pg1", "EffectiveValue", Any( static_cast<double>(nJPEGQuality) ) );
510 setControlProperty( "CheckBox1Pg1", "State", Any( static_cast<sal_Int16>(bRemoveCropArea) ) );
511 setControlProperty( "ComboBox0Pg1", "Text", Any( aResolutionText ) );
512 setControlProperty( "CheckBox2Pg1", "State", Any( static_cast<sal_Int16>(bEmbedLinkedGraphics) ) );
514 void OptimizerDialog::InitPage2()
516 Sequence< OUString > aResolutionItemList( 4 );
517 aResolutionItemList[ 0 ] = getString( STR_IMAGE_RESOLUTION_0 ).getToken( 1, ';' );
518 aResolutionItemList[ 1 ] = getString( STR_IMAGE_RESOLUTION_1 ).getToken( 1, ';' );
519 aResolutionItemList[ 2 ] = getString( STR_IMAGE_RESOLUTION_2 ).getToken( 1, ';' );
520 aResolutionItemList[ 3 ] = getString( STR_IMAGE_RESOLUTION_3 ).getToken( 1, ';' );
522 std::vector< OUString > aControlList;
523 aControlList.push_back( InsertFixedText( *this, "FixedText0Pg1", getString( STR_GRAPHIC_OPTIMIZATION ), PAGE_POS_X, PAGE_POS_Y, PAGE_WIDTH, 8, false, true, mnTabIndex++ ) );
524 aControlList.push_back( InsertRadioButton( *this, "RadioButton0Pg1", mxItemListener, getString( STR_LOSSLESS_COMPRESSION ), PAGE_POS_X + 6, PAGE_POS_Y + 14, PAGE_WIDTH - 12, mnTabIndex++ ) );
525 aControlList.push_back( InsertRadioButton( *this, "RadioButton1Pg1", mxItemListener, getString( STR_JPEG_COMPRESSION ), PAGE_POS_X + 6, PAGE_POS_Y + 28, PAGE_WIDTH - 12, mnTabIndex++ ) );
526 aControlList.push_back( InsertFixedText( *this, "FixedText1Pg1", getString( STR_QUALITY ), PAGE_POS_X + 20, PAGE_POS_Y + 40, 72, 8, false, false, mnTabIndex++ ) );
527 aControlList.push_back( InsertFormattedField( *this, "FormattedField0Pg1", mxTextListenerFormattedField0Pg1, mxSpinListenerFormattedField0Pg1, PAGE_POS_X + 106, PAGE_POS_Y + 38, 0, 100, mnTabIndex++ ) );
528 aControlList.push_back( InsertFixedText( *this, "FixedText2Pg1", getString( STR_IMAGE_RESOLUTION ), PAGE_POS_X + 6, PAGE_POS_Y + 54, 94, 8, false, false, mnTabIndex++ ) );
529 aControlList.push_back( InsertComboBox( *this, "ComboBox0Pg1", mxTextListenerComboBox0Pg1, true, aResolutionItemList, PAGE_POS_X + 106, PAGE_POS_Y + 52, mnTabIndex++ ) );
530 aControlList.push_back( InsertCheckBox( *this, "CheckBox1Pg1", mxItemListener, getString( STR_REMOVE_CROP_AREA ), PAGE_POS_X + 6, PAGE_POS_Y + 68, PAGE_WIDTH - 12, mnTabIndex++ ) );
531 aControlList.push_back( InsertCheckBox( *this, "CheckBox2Pg1", mxItemListener, getString( STR_EMBED_LINKED_GRAPHICS ), PAGE_POS_X + 6, PAGE_POS_Y + 82, PAGE_WIDTH - 12, mnTabIndex++ ) );
532 maControlPages.push_back( aControlList );
533 DeactivatePage( 2 );
534 UpdateControlStatesPage2();
538 void OptimizerDialog::UpdateControlStatesPage3()
540 bool bConvertOLEObjects( GetConfigProperty( TK_OLEOptimization, false ) );
541 sal_Int16 nOLEOptimizationType( GetConfigProperty( TK_OLEOptimizationType, sal_Int16(0) ) );
543 setControlProperty( "CheckBox0Pg2", "State", Any( static_cast<sal_Int16>(bConvertOLEObjects) ) );
544 setControlProperty( "RadioButton0Pg2", "Enabled", Any( bConvertOLEObjects ) );
545 setControlProperty( "RadioButton0Pg2", "State", Any( static_cast<sal_Int16>( nOLEOptimizationType == 0 ) ) );
546 setControlProperty( "RadioButton1Pg2", "Enabled", Any( bConvertOLEObjects ) );
547 setControlProperty( "RadioButton1Pg2", "State", Any( static_cast<sal_Int16>( nOLEOptimizationType == 1 ) ) );
549 void OptimizerDialog::InitPage3()
551 int nOLECount = 0;
552 Reference< XModel > xModel( mxController->getModel() );
553 Reference< XDrawPagesSupplier > xDrawPagesSupplier( xModel, UNO_QUERY_THROW );
554 Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW );
555 for ( sal_Int32 i = 0; i < xDrawPages->getCount(); i++ )
557 Reference< XShapes > xShapes( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
558 for ( sal_Int32 j = 0; j < xShapes->getCount(); j++ )
560 const OUString sOLE2Shape( "com.sun.star.drawing.OLE2Shape" );
561 Reference< XShape > xShape( xShapes->getByIndex( j ), UNO_QUERY_THROW );
562 if ( xShape->getShapeType() == sOLE2Shape )
563 nOLECount++;
567 std::vector< OUString > aControlList;
568 aControlList.push_back( InsertFixedText( *this, "FixedText0Pg2", getString( STR_OLE_OPTIMIZATION ), PAGE_POS_X, PAGE_POS_Y, PAGE_WIDTH, 8, false, true, mnTabIndex++ ) );
569 aControlList.push_back( InsertCheckBox( *this, "CheckBox0Pg2", mxItemListener, getString( STR_OLE_REPLACE ), PAGE_POS_X + 6, PAGE_POS_Y + 14, PAGE_WIDTH - 12, mnTabIndex++ ) );
570 aControlList.push_back( InsertRadioButton( *this, "RadioButton0Pg2", mxItemListener, getString( STR_ALL_OLE_OBJECTS ), PAGE_POS_X + 14, PAGE_POS_Y + 28, PAGE_WIDTH - 22, mnTabIndex++ ) );
571 aControlList.push_back( InsertRadioButton( *this, "RadioButton1Pg2", mxItemListener, getString( STR_ALIEN_OLE_OBJECTS_ONLY ), PAGE_POS_X + 14, PAGE_POS_Y + 40, PAGE_WIDTH - 22, mnTabIndex++ ) );
572 aControlList.push_back( InsertFixedText( *this, "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, true, false, mnTabIndex++ ) );
573 maControlPages.push_back( aControlList );
574 DeactivatePage( 3 );
575 UpdateControlStatesPage3();
579 static OUString ImpValueOfInMB( sal_Int64 rVal, sal_Unicode nSeparator )
581 double fVal( static_cast<double>( rVal ) );
582 fVal /= ( 1 << 20 );
583 fVal += 0.05;
584 OUStringBuffer aVal( OUString::number( fVal ) );
585 sal_Int32 nX( OUString( aVal.getStr() ).indexOf( '.' ) );
586 if ( nX >= 0 )
588 aVal.setLength( nX + 2 );
589 aVal[nX] = nSeparator;
591 aVal.append( " MB" );
592 return aVal.makeStringAndClear();
595 void OptimizerDialog::UpdateControlStatesPage4()
597 bool bSaveAs( GetConfigProperty( TK_SaveAs, true ) );
598 if ( mbIsReadonly )
600 setControlProperty( "RadioButton0Pg4", "State", Any( sal_Int16(false) ) );
601 setControlProperty( "RadioButton1Pg4", "State", Any( sal_Int16(true) ) );
603 else
605 setControlProperty( "RadioButton0Pg4", "State", Any( static_cast<sal_Int16>( !bSaveAs ) ) );
606 setControlProperty( "RadioButton1Pg4", "State", Any( static_cast<sal_Int16>(bSaveAs) ) );
608 setControlProperty( "ComboBox0Pg4", "Enabled", Any( false ) );
610 Sequence< OUString > aItemList;
611 const std::vector< OptimizerSettings >& rList( GetOptimizerSettings() );
612 if ( rList.size() > 1 ) // the first session in the list is the actual one -> skipping first one
614 aItemList.realloc( rList.size() - 1 );
615 for ( std::vector<OptimizerSettings>::size_type w = 1; w < rList.size(); w++ )
616 aItemList[ w - 1 ] = rList[ w ].maName;
618 setControlProperty( "ComboBox0Pg4", "StringItemList", Any( aItemList ) );
620 // now check if it is sensible to enable the combo box
621 bool bSaveSettingsEnabled = true;
622 if ( rList.size() > 1 ) // the first session in the list is the actual one -> skipping first one
624 for ( std::vector<OptimizerSettings>::size_type w = 1; w < rList.size(); w++ )
626 if ( rList[ w ] == rList[ 0 ] )
628 bSaveSettingsEnabled = false;
629 break;
633 sal_Int16 nInt16 = 0;
634 getControlProperty( "CheckBox1Pg4", "State" ) >>= nInt16;
635 setControlProperty( "CheckBox1Pg4", "Enabled", Any( bSaveSettingsEnabled ) );
636 setControlProperty( "ComboBox0Pg4", "Enabled", Any( bSaveSettingsEnabled && nInt16 ) );
638 std::vector< OUString > aSummaryStrings;
640 // taking care of deleted slides
641 sal_Int32 nDeletedSlides = 0;
642 OUString aCustomShowName;
643 if ( getControlProperty( "CheckBox3Pg3", "State" ) >>= nInt16 )
645 if ( nInt16 )
647 Sequence< short > aSelectedItems;
648 Sequence< OUString > aStringItemList;
649 Any aAny = getControlProperty( "ListBox0Pg3", "SelectedItems" );
650 if ( aAny >>= aSelectedItems )
652 if ( aSelectedItems.hasElements() )
654 sal_Int16 nSelectedItem = aSelectedItems[ 0 ];
655 aAny = getControlProperty( "ListBox0Pg3", "StringItemList" );
656 if ( aAny >>= aStringItemList )
658 if ( aStringItemList.getLength() > nSelectedItem )
659 SetConfigProperty( TK_CustomShowName, Any( aStringItemList[ nSelectedItem ] ) );
665 if ( !aCustomShowName.isEmpty() )
667 std::vector< Reference< XDrawPage > > vNonUsedPageList;
668 PageCollector::CollectNonCustomShowPages( mxController->getModel(), aCustomShowName, vNonUsedPageList );
669 nDeletedSlides += vNonUsedPageList.size();
671 if ( GetConfigProperty( TK_DeleteHiddenSlides, false ) )
673 if ( !aCustomShowName.isEmpty() )
675 std::vector< Reference< XDrawPage > > vUsedPageList;
676 PageCollector::CollectCustomShowPages( mxController->getModel(), aCustomShowName, vUsedPageList );
677 for( const auto& rxPage : vUsedPageList )
679 Reference< XPropertySet > xPropSet( rxPage, UNO_QUERY_THROW );
680 bool bVisible = true;
681 const OUString sVisible( "Visible" );
682 if ( xPropSet->getPropertyValue( sVisible ) >>= bVisible )
684 if (!bVisible )
685 nDeletedSlides++;
689 else
691 Reference< XDrawPagesSupplier > xDrawPagesSupplier( mxController->getModel(), UNO_QUERY_THROW );
692 Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW );
693 for( sal_Int32 i = 0; i < xDrawPages->getCount(); i++ )
695 Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
696 Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY_THROW );
698 bool bVisible = true;
699 const OUString sVisible( "Visible" );
700 if ( xPropSet->getPropertyValue( sVisible ) >>= bVisible )
702 if (!bVisible )
703 nDeletedSlides++;
708 if ( GetConfigProperty( TK_DeleteUnusedMasterPages, false ) )
710 std::vector< PageCollector::MasterPageEntity > aMasterPageList;
711 PageCollector::CollectMasterPages( mxController->getModel(), aMasterPageList );
712 Reference< XMasterPagesSupplier > xMasterPagesSupplier( mxController->getModel(), UNO_QUERY_THROW );
713 Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_SET_THROW );
714 nDeletedSlides += std::count_if(aMasterPageList.begin(), aMasterPageList.end(),
715 [](const PageCollector::MasterPageEntity& rEntity) { return !rEntity.bUsed; });
717 if ( nDeletedSlides > 1 )
719 OUString aStr( getString( STR_DELETE_SLIDES ) );
720 OUString aPlaceholder( "%SLIDES" );
721 sal_Int32 i = aStr.indexOf( aPlaceholder );
722 if ( i >= 0 )
723 aStr = aStr.replaceAt( i, aPlaceholder.getLength(), OUString::number( nDeletedSlides ) );
724 aSummaryStrings.push_back( aStr );
727 // generating graphic compression info
728 sal_Int32 nGraphics = 0;
729 bool bJPEGCompression( GetConfigProperty( TK_JPEGCompression, false ) );
730 sal_Int32 nJPEGQuality( GetConfigProperty( TK_JPEGQuality, sal_Int32(90) ) );
731 sal_Int32 nImageResolution( GetConfigProperty( TK_ImageResolution, sal_Int32(0) ) );
732 GraphicSettings aGraphicSettings( bJPEGCompression, nJPEGQuality, GetConfigProperty( TK_RemoveCropArea, false ),
733 nImageResolution, GetConfigProperty( TK_EmbedLinkedGraphics, true ) );
734 GraphicCollector::CountGraphics( UnoDialog::mxContext, mxController->getModel(), aGraphicSettings, nGraphics );
735 if ( nGraphics > 1 )
737 OUString aStr( getString( STR_OPTIMIZE_IMAGES ) );
738 OUString aImagePlaceholder( "%IMAGES" );
739 OUString aQualityPlaceholder( "%QUALITY" );
740 OUString aResolutionPlaceholder( "%RESOLUTION" );
741 sal_Int32 i = aStr.indexOf( aImagePlaceholder );
742 if ( i >= 0 )
743 aStr = aStr.replaceAt( i, aImagePlaceholder.getLength(), OUString::number( nGraphics ) );
745 sal_Int32 j = aStr.indexOf( aQualityPlaceholder );
746 if ( j >= 0 )
747 aStr = aStr.replaceAt( j, aQualityPlaceholder.getLength(), OUString::number( nJPEGQuality ) );
749 sal_Int32 k = aStr.indexOf( aResolutionPlaceholder );
750 if ( k >= 0 )
751 aStr = aStr.replaceAt( k, aResolutionPlaceholder.getLength(), OUString::number( nImageResolution ) );
753 aSummaryStrings.push_back( aStr );
756 if ( GetConfigProperty( TK_OLEOptimization, false ) )
758 sal_Int32 nOLEReplacements = 0;
759 Reference< XDrawPagesSupplier > xDrawPagesSupplier( mxController->getModel(), UNO_QUERY_THROW );
760 Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW );
761 for ( sal_Int32 i = 0; i < xDrawPages->getCount(); i++ )
763 Reference< XShapes > xShapes( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
764 for ( sal_Int32 j = 0; j < xShapes->getCount(); j++ )
766 const OUString sOLE2Shape( "com.sun.star.drawing.OLE2Shape" );
767 Reference< XShape > xShape( xShapes->getByIndex( j ), UNO_QUERY_THROW );
768 if ( xShape->getShapeType() == sOLE2Shape )
769 nOLEReplacements++;
772 if ( nOLEReplacements > 1 )
774 OUString aStr( getString( STR_CREATE_REPLACEMENT ) );
775 OUString aPlaceholder( "%OLE" );
776 sal_Int32 i = aStr.indexOf( aPlaceholder );
777 if ( i >= 0 )
778 aStr = aStr.replaceAt( i, aPlaceholder.getLength(), OUString::number( nOLEReplacements ) );
779 aSummaryStrings.push_back( aStr );
782 while( aSummaryStrings.size() < 3 )
783 aSummaryStrings.emplace_back( );
784 setControlProperty( "FixedText4Pg4", "Label", Any( aSummaryStrings[ 0 ] ) );
785 setControlProperty( "FixedText5Pg4", "Label", Any( aSummaryStrings[ 1 ] ) );
786 setControlProperty( "FixedText6Pg4", "Label", Any( aSummaryStrings[ 2 ] ) );
788 sal_Int64 nCurrentFileSize = 0;
789 sal_Int64 nEstimatedFileSize = 0;
790 Reference< XStorable > xStorable( mxController->getModel(), UNO_QUERY );
791 if ( xStorable.is() && xStorable->hasLocation() )
792 nCurrentFileSize = PPPOptimizer::GetFileSize( xStorable->getLocation() );
794 if ( nCurrentFileSize )
796 double fE = static_cast< double >( nCurrentFileSize );
797 if ( nImageResolution )
799 double v = ( static_cast< double >( nImageResolution ) + 75.0 ) / 300.0;
800 if ( v < 1.0 )
801 fE *= v;
803 if ( bJPEGCompression )
805 double v = 0.75 - ( ( 100.0 - static_cast< double >( nJPEGQuality ) ) / 400.0 ) ;
806 fE *= v;
808 nEstimatedFileSize = static_cast< sal_Int64 >( fE );
810 sal_Unicode nSeparator = '.';
811 OUString aStr( getString( STR_FILESIZESEPARATOR ) );
812 if ( !aStr.isEmpty() )
813 nSeparator = aStr[ 0 ];
814 setControlProperty( "FixedText7Pg4", "Label", Any( ImpValueOfInMB( nCurrentFileSize, nSeparator ) ) );
815 setControlProperty( "FixedText8Pg4", "Label", Any( ImpValueOfInMB( nEstimatedFileSize, nSeparator ) ) );
816 SetConfigProperty( TK_EstimatedFileSize, Any( nEstimatedFileSize ) );
819 void OptimizerDialog::InitPage4()
821 { // creating progress bar:
822 OUString pNames[] = {
823 OUString("Height"),
824 OUString("Name"),
825 OUString("PositionX"),
826 OUString("PositionY"),
827 OUString("ProgressValue"),
828 OUString("ProgressValueMax"),
829 OUString("ProgressValueMin"),
830 OUString("Width") };
832 Any pValues[] = {
833 Any( sal_Int32(12) ),
834 Any( OUString("STR_SAVE_AS") ),
835 Any( sal_Int32( PAGE_POS_X + 6 ) ),
836 Any( sal_Int32( DIALOG_HEIGHT - 75 ) ),
837 Any( sal_Int32(0) ),
838 Any( sal_Int32(100) ),
839 Any( sal_Int32(0) ),
840 Any( sal_Int32( PAGE_WIDTH - 12 ) ) };
842 sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
844 Sequence< OUString > aNames( pNames, nCount );
845 Sequence< Any > aValues( pValues, nCount );
847 Reference< XMultiPropertySet > xMultiPropertySet( insertControlModel( "com.sun.star.awt.UnoControlProgressBarModel",
848 "Progress", aNames, aValues ), UNO_QUERY );
850 Reference< XTextListener > xTextListener;
851 Sequence< OUString > aItemList;
852 std::vector< OUString > aControlList;
853 aControlList.push_back( InsertFixedText( *this, "FixedText0Pg4", getString( STR_SUMMARY_TITLE ), PAGE_POS_X, PAGE_POS_Y, PAGE_WIDTH, 8, false, true, mnTabIndex++ ) );
854 // aControlList.push_back( InsertSeparator( *this, "Separator0Pg4", 0, PAGE_POS_X + 6, PAGE_POS_Y + 90, PAGE_WIDTH - 12, 1 ) );
856 aControlList.push_back( InsertFixedText( *this, "FixedText4Pg4", OUString(), PAGE_POS_X + 6, PAGE_POS_Y + 14, PAGE_WIDTH - 12, 8, false, false, mnTabIndex++ ) );
857 aControlList.push_back( InsertFixedText( *this, "FixedText5Pg4", OUString(), PAGE_POS_X + 6, PAGE_POS_Y + 22, PAGE_WIDTH - 12, 8, false, false, mnTabIndex++ ) );
858 aControlList.push_back( InsertFixedText( *this, "FixedText6Pg4", OUString(), PAGE_POS_X + 6, PAGE_POS_Y + 30, PAGE_WIDTH - 12, 8, false, false, mnTabIndex++ ) );
860 aControlList.push_back( InsertFixedText( *this, "FixedText2Pg4", getString( STR_CURRENT_FILESIZE ), PAGE_POS_X + 6, PAGE_POS_Y + 50, 88, 8, false, false, mnTabIndex++ ) );
861 aControlList.push_back( InsertFixedText( *this, "FixedText7Pg4", OUString(), PAGE_POS_X + 100, PAGE_POS_Y + 50, 30, 8, false, false, mnTabIndex++ ) );
862 setControlProperty( "FixedText7Pg4", "Align", Any( static_cast< short >( 2 ) ) );
863 aControlList.push_back( InsertFixedText( *this, "FixedText3Pg4", getString( STR_ESTIMATED_FILESIZE ), PAGE_POS_X + 6, PAGE_POS_Y + 58, 88, 8, false, false, mnTabIndex++ ) );
864 aControlList.push_back( InsertFixedText( *this, "FixedText8Pg4", OUString(), PAGE_POS_X + 100, PAGE_POS_Y + 58, 30, 8, false, false, mnTabIndex++ ) );
865 setControlProperty( "FixedText8Pg4", "Align", Any( static_cast< short >( 2 ) ) );
867 aControlList.push_back( InsertRadioButton( *this, "RadioButton0Pg4", mxItemListener, getString( STR_APPLY_TO_CURRENT ), PAGE_POS_X + 6, PAGE_POS_Y + 78, PAGE_WIDTH - 12, mnTabIndex++ ) );
868 aControlList.push_back( InsertRadioButton( *this, "RadioButton1Pg4", mxItemListener, getString( STR_SAVE_AS ), PAGE_POS_X + 6, PAGE_POS_Y + 90, PAGE_WIDTH - 12, mnTabIndex++ ) );
869 aControlList.push_back( InsertFixedText( *this, "FixedText1Pg4", OUString(), PAGE_POS_X + 6, DIALOG_HEIGHT - 87, PAGE_WIDTH - 12, 8, true, false, mnTabIndex++ ) );
870 aControlList.emplace_back("Progress" );
871 aControlList.push_back( InsertSeparator( *this, "Separator1Pg4", 0, PAGE_POS_X + 6, DIALOG_HEIGHT - 58, PAGE_WIDTH - 12, 1 ) );
872 aControlList.push_back( InsertCheckBox( *this, "CheckBox1Pg4", mxItemListener, getString( STR_SAVE_SETTINGS ), PAGE_POS_X + 6, DIALOG_HEIGHT - 47, 100, mnTabIndex++ ) );
873 aControlList.push_back( InsertComboBox( *this, "ComboBox0Pg4", xTextListener, true, aItemList, PAGE_POS_X + 106, DIALOG_HEIGHT - 48, mnTabIndex++ ) );
874 maControlPages.push_back( aControlList );
875 DeactivatePage( 4 );
877 // creating a default session name that hasn't been used yet
878 OUString aSettingsName;
879 OUString aDefault( getString( STR_MY_SETTINGS ) );
880 sal_Int32 nSession = 1;
881 std::vector<OptimizerSettings>::size_type i;
882 const std::vector< OptimizerSettings >& rList( GetOptimizerSettings() );
885 OUString aTemp( aDefault.concat( OUString::number( nSession++ ) ) );
886 for ( i = 1; i < rList.size(); i++ )
888 if ( rList[ i ].maName == aTemp )
889 break;
891 if ( i == rList.size() )
892 aSettingsName = aTemp;
894 while( aSettingsName.isEmpty() );
896 setControlProperty( "ComboBox0Pg4", "Text", Any( aSettingsName ) );
897 setControlProperty( "RadioButton0Pg4", "Enabled", Any( !mbIsReadonly ) );
898 setControlProperty( "RadioButton1Pg4", "Enabled", Any( !mbIsReadonly ) );
900 UpdateControlStatesPage4();
904 void OptimizerDialog::EnablePage( sal_Int16 nStep )
906 for( const auto& rItem : maControlPages[ nStep ] )
907 setControlProperty( rItem, "Enabled", Any( true ) );
909 void OptimizerDialog::DisablePage( sal_Int16 nStep )
911 for( const auto& rItem : maControlPages[ nStep ] )
912 setControlProperty( rItem, "Enabled", Any( false ) );
914 void OptimizerDialog::ActivatePage( sal_Int16 nStep )
916 for( const auto& rItem : maControlPages[ nStep ] )
917 setVisible( rItem, true );
919 void OptimizerDialog::DeactivatePage( sal_Int16 nStep )
921 for( const auto& rItem : maControlPages[ nStep ] )
922 setVisible( rItem, false );
925 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */