LibreOffice Module sdext (master)  1
optimizerdialogcontrols.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 
21 #include "optimizerdialog.hxx"
22 
23 
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>
38 
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;
48 
49 
50 static void SetBold( OptimizerDialog& rOptimizerDialog, const OUString& rControl )
51 {
52  FontDescriptor aFontDescriptor;
53  if ( rOptimizerDialog.getControlProperty( rControl, "FontDescriptor" ) >>= aFontDescriptor )
54  {
55  aFontDescriptor.Weight = com::sun::star::awt::FontWeight::BOLD;
56  rOptimizerDialog.setControlProperty( rControl, "FontDescriptor", Any( aFontDescriptor ) );
57  }
58 }
59 
60 
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 )
63 {
64  OUString pNames[] = {
65  OUString("Height"),
66  OUString("Orientation"),
67  OUString("PositionX"),
68  OUString("PositionY"),
69  OUString("Step"),
70  OUString("Width") };
71 
72  Any pValues[] = {
73  Any( nHeight ),
74  Any( nOrientation ),
75  Any( nPosX ),
76  Any( nPosY ),
77  Any( sal_Int16( 0 ) ),
78  Any( nWidth ) };
79 
80  sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
81 
82  Sequence< OUString > aNames( pNames, nCount );
83  Sequence< Any > aValues( pValues, nCount );
84 
85  rOptimizerDialog.insertControlModel( "com.sun.star.awt.UnoControlFixedLineModel",
86  rControlName, aNames, aValues );
87  return rControlName;
88 }
89 
90 
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 )
93 {
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") };
105 
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 ) };
116 
117 
118  sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
119 
120  Sequence< OUString > aNames( pNames, nCount );
121  Sequence< Any > aValues( pValues, nCount );
122 
123  rOptimizerDialog.insertButton( rControlName, xActionListener, aNames, aValues );
124  return rControlName;
125 }
126 
127 
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 )
130 {
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") };
140 
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 ) };
150 
151  sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
152 
153  Sequence< OUString > aNames( pNames, nCount );
154  Sequence< Any > aValues( pValues, nCount );
155 
156  rOptimizerDialog.insertFixedText( rControlName, aNames, aValues );
157  if ( bBold )
158  SetBold( rOptimizerDialog, rControlName );
159  return rControlName;
160 }
161 
162 
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 )
166 {
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") };
177 
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 ) };
187 
188  sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
189 
190  Sequence< OUString > aNames( pNames, nCount );
191  Sequence< Any > aValues( pValues, nCount );
192 
193  Reference< XCheckBox > xCheckBox( rOptimizerDialog.insertCheckBox( rControlName, aNames, aValues ) );
194  if ( xItemListener.is() )
195  xCheckBox->addItemListener( xItemListener );
196  return rControlName;
197 }
198 
199 
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 )
203 {
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") };
217 
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 ) };
230 
231  sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
232 
233  Sequence< OUString > aNames( pNames, nCount );
234  Sequence< Any > aValues( pValues, nCount );
235 
236  Reference< XTextComponent > xTextComponent( rOptimizerDialog.insertFormattedField( rControlName, aNames, aValues ), UNO_QUERY_THROW );
237  if ( xTextListener.is() )
238  xTextComponent->addTextListener( xTextListener );
239  if ( xSpinListener.is() )
240  {
241  Reference< XSpinField > xSpinField( xTextComponent, UNO_QUERY_THROW );
242  xSpinField->addSpinListener( xSpinListener );
243  }
244  return rControlName;
245 }
246 
247 
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 )
251 {
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") };
265 
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 ) };
277 
278  sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
279 
280  Sequence< OUString > aNames( pNames, nCount );
281  Sequence< Any > aValues( pValues, nCount );
282 
283  Reference< XTextComponent > xTextComponent( rOptimizerDialog.insertComboBox( rControlName, aNames, aValues ), UNO_QUERY_THROW );
284  if ( rTextListener.is() )
285  xTextComponent->addTextListener( rTextListener );
286  return rControlName;
287 }
288 
289 
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 )
292 {
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") };
303 
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 ) };
313 
314  sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
315 
316  Sequence< OUString > aNames( pNames, nCount );
317  Sequence< Any > aValues( pValues, nCount );
318 
319  Reference< XRadioButton > xRadioButton( rOptimizerDialog.insertRadioButton( rControlName, aNames, aValues ) );
320  if ( rItemListener.is() )
321  xRadioButton->addItemListener( rItemListener );
322  return rControlName;
323 }
324 
325 
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 )
329 {
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") };
343 
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 ) };
356 
357  sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
358 
359  Sequence< OUString > aNames( pNames, nCount );
360  Sequence< Any > aValues( pValues, nCount );
361 
362  Reference< XListBox > xListBox( rOptimizerDialog.insertListBox( rControlName, aNames, aValues ) );
363  if ( xListBox.is() )
364  xListBox->addActionListener( rActionListener );
365  return rControlName;
366 }
367 
368 
370 {
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;
375 
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 );
378 
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 );
383 
384  setControlProperty( "btnNavNext", "DefaultButton", Any( true ) );
385 }
386 
387 
389 {
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
394  {
395  aItemList.realloc( rList.size() - 1 );
396  for ( std::vector<OptimizerSettings>::size_type i = 1; i < rList.size(); i++ )
397  {
398  aItemList[ i - 1 ] = rList[ i ].maName;
399  if ( nSelectedItem < 0 )
400  {
401  if ( rList[ i ] == rList[ 0 ] )
402  nSelectedItem = static_cast< short >( i - 1 );
403  }
404  }
405  }
406  bool bRemoveButtonEnabled = false;
407  Sequence< short > aSelectedItems;
408  if ( nSelectedItem >= 0 )
409  {
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;
414  }
415  setControlProperty( "ListBox0Pg0", "StringItemList", Any( aItemList ) );
416  setControlProperty( "ListBox0Pg0", "SelectedItems", Any( aSelectedItems ) );
417  setControlProperty( "Button0Pg0", "Enabled", Any( bRemoveButtonEnabled ) );
418 }
420 {
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 );
432 }
433 
434 
436 {
437  bool bDeleteUnusedMasterPages( GetConfigProperty( TK_DeleteUnusedMasterPages, false ) );
438  bool bDeleteHiddenSlides( GetConfigProperty( TK_DeleteHiddenSlides, false ) );
439  bool bDeleteNotesPages( GetConfigProperty( TK_DeleteNotesPages, false ) );
440 
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) ) );
444 }
446 {
447  Sequence< OUString > aCustomShowList;
448  Reference< XModel > xModel( mxController->getModel() );
449  if ( xModel.is() )
450  {
451  Reference< XCustomPresentationSupplier > aXCPSup( xModel, UNO_QUERY_THROW );
452  Reference< XNameContainer > aXCont( aXCPSup->getCustomPresentations() );
453  if ( aXCont.is() )
454  aCustomShowList = aXCont->getElementNames();
455  }
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 );
465 
466  setControlProperty( "CheckBox3Pg3", "State", Any( false ) );
467  setControlProperty( "CheckBox3Pg3", "Enabled", Any( aCustomShowList.hasElements() ) );
468  setControlProperty( "ListBox0Pg3", "Enabled", Any( false ) );
469 
471 }
472 
473 namespace
474 {
475 
476 bool lcl_getResolutionText(OUString& rResolutionText, const OUString& rImageResolution, sal_Int32 nTargetRes)
477 {
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;
483 }
484 
485 }
486 
488 {
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) ) );
493 
494  sal_Int32 nImageResolution( GetConfigProperty( TK_ImageResolution, sal_Int32(0) ) );
495 
496  OUString aResolutionText;
497  for (int nIR{ STR_IMAGE_RESOLUTION_0 }; nIR<=STR_IMAGE_RESOLUTION_3; ++nIR)
498  {
499  if (lcl_getResolutionText(aResolutionText, getString(static_cast<PPPOptimizerTokenEnum>(nIR)), nImageResolution))
500  break;
501  }
502  if ( aResolutionText.isEmpty() )
503  aResolutionText = OUString::number( nImageResolution );
504 
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) ) );
513 }
515 {
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, ';' );
521 
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 );
535 }
536 
537 
539 {
540  bool bConvertOLEObjects( GetConfigProperty( TK_OLEOptimization, false ) );
541  sal_Int16 nOLEOptimizationType( GetConfigProperty( TK_OLEOptimizationType, sal_Int16(0) ) );
542 
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 ) ) );
548 }
550 {
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++ )
556  {
557  Reference< XShapes > xShapes( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
558  for ( sal_Int32 j = 0; j < xShapes->getCount(); j++ )
559  {
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++;
564  }
565  }
566 
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 );
576 }
577 
578 
579 static OUString ImpValueOfInMB( sal_Int64 rVal, sal_Unicode nSeparator )
580 {
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 )
587  {
588  aVal.setLength( nX + 2 );
589  aVal[nX] = nSeparator;
590  }
591  aVal.append( " MB" );
592  return aVal.makeStringAndClear();
593 }
594 
596 {
597  bool bSaveAs( GetConfigProperty( TK_SaveAs, true ) );
598  if ( mbIsReadonly )
599  {
600  setControlProperty( "RadioButton0Pg4", "State", Any( sal_Int16(false) ) );
601  setControlProperty( "RadioButton1Pg4", "State", Any( sal_Int16(true) ) );
602  }
603  else
604  {
605  setControlProperty( "RadioButton0Pg4", "State", Any( static_cast<sal_Int16>( !bSaveAs ) ) );
606  setControlProperty( "RadioButton1Pg4", "State", Any( static_cast<sal_Int16>(bSaveAs) ) );
607  }
608  setControlProperty( "ComboBox0Pg4", "Enabled", Any( false ) );
609 
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
613  {
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;
617  }
618  setControlProperty( "ComboBox0Pg4", "StringItemList", Any( aItemList ) );
619 
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
623  {
624  for ( std::vector<OptimizerSettings>::size_type w = 1; w < rList.size(); w++ )
625  {
626  if ( rList[ w ] == rList[ 0 ] )
627  {
628  bSaveSettingsEnabled = false;
629  break;
630  }
631  }
632  }
633  sal_Int16 nInt16 = 0;
634  getControlProperty( "CheckBox1Pg4", "State" ) >>= nInt16;
635  setControlProperty( "CheckBox1Pg4", "Enabled", Any( bSaveSettingsEnabled ) );
636  setControlProperty( "ComboBox0Pg4", "Enabled", Any( bSaveSettingsEnabled && nInt16 ) );
637 
638  std::vector< OUString > aSummaryStrings;
639 
640  // taking care of deleted slides
641  sal_Int32 nDeletedSlides = 0;
642  OUString aCustomShowName;
643  if ( getControlProperty( "CheckBox3Pg3", "State" ) >>= nInt16 )
644  {
645  if ( nInt16 )
646  {
647  Sequence< short > aSelectedItems;
648  Sequence< OUString > aStringItemList;
649  Any aAny = getControlProperty( "ListBox0Pg3", "SelectedItems" );
650  if ( aAny >>= aSelectedItems )
651  {
652  if ( aSelectedItems.hasElements() )
653  {
654  sal_Int16 nSelectedItem = aSelectedItems[ 0 ];
655  aAny = getControlProperty( "ListBox0Pg3", "StringItemList" );
656  if ( aAny >>= aStringItemList )
657  {
658  if ( aStringItemList.getLength() > nSelectedItem )
659  SetConfigProperty( TK_CustomShowName, Any( aStringItemList[ nSelectedItem ] ) );
660  }
661  }
662  }
663  }
664  }
665  if ( !aCustomShowName.isEmpty() )
666  {
667  std::vector< Reference< XDrawPage > > vNonUsedPageList;
668  PageCollector::CollectNonCustomShowPages( mxController->getModel(), aCustomShowName, vNonUsedPageList );
669  nDeletedSlides += vNonUsedPageList.size();
670  }
672  {
673  if ( !aCustomShowName.isEmpty() )
674  {
675  std::vector< Reference< XDrawPage > > vUsedPageList;
676  PageCollector::CollectCustomShowPages( mxController->getModel(), aCustomShowName, vUsedPageList );
677  for( const auto& rxPage : vUsedPageList )
678  {
679  Reference< XPropertySet > xPropSet( rxPage, UNO_QUERY_THROW );
680  bool bVisible = true;
681  const OUString sVisible( "Visible" );
682  if ( xPropSet->getPropertyValue( sVisible ) >>= bVisible )
683  {
684  if (!bVisible )
685  nDeletedSlides++;
686  }
687  }
688  }
689  else
690  {
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++ )
694  {
695  Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
696  Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY_THROW );
697 
698  bool bVisible = true;
699  const OUString sVisible( "Visible" );
700  if ( xPropSet->getPropertyValue( sVisible ) >>= bVisible )
701  {
702  if (!bVisible )
703  nDeletedSlides++;
704  }
705  }
706  }
707  }
709  {
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; });
716  }
717  if ( nDeletedSlides > 1 )
718  {
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 );
725  }
726 
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 )
736  {
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 ) );
744 
745  sal_Int32 j = aStr.indexOf( aQualityPlaceholder );
746  if ( j >= 0 )
747  aStr = aStr.replaceAt( j, aQualityPlaceholder.getLength(), OUString::number( nJPEGQuality ) );
748 
749  sal_Int32 k = aStr.indexOf( aResolutionPlaceholder );
750  if ( k >= 0 )
751  aStr = aStr.replaceAt( k, aResolutionPlaceholder.getLength(), OUString::number( nImageResolution ) );
752 
753  aSummaryStrings.push_back( aStr );
754  }
755 
756  if ( GetConfigProperty( TK_OLEOptimization, false ) )
757  {
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++ )
762  {
763  Reference< XShapes > xShapes( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
764  for ( sal_Int32 j = 0; j < xShapes->getCount(); j++ )
765  {
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++;
770  }
771  }
772  if ( nOLEReplacements > 1 )
773  {
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 );
780  }
781  }
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 ] ) );
787 
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() );
793 
794  if ( nCurrentFileSize )
795  {
796  double fE = static_cast< double >( nCurrentFileSize );
797  if ( nImageResolution )
798  {
799  double v = ( static_cast< double >( nImageResolution ) + 75.0 ) / 300.0;
800  if ( v < 1.0 )
801  fE *= v;
802  }
803  if ( bJPEGCompression )
804  {
805  double v = 0.75 - ( ( 100.0 - static_cast< double >( nJPEGQuality ) ) / 400.0 ) ;
806  fE *= v;
807  }
808  nEstimatedFileSize = static_cast< sal_Int64 >( fE );
809  }
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 ) );
817 }
818 
820 {
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") };
831 
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 ) ) };
841 
842  sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
843 
844  Sequence< OUString > aNames( pNames, nCount );
845  Sequence< Any > aValues( pValues, nCount );
846 
847  Reference< XMultiPropertySet > xMultiPropertySet( insertControlModel( "com.sun.star.awt.UnoControlProgressBarModel",
848  "Progress", aNames, aValues ), UNO_QUERY );
849  }
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 ) );
855 
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++ ) );
859 
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 ) ) );
866 
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 );
876 
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() );
883  do
884  {
885  OUString aTemp( aDefault.concat( OUString::number( nSession++ ) ) );
886  for ( i = 1; i < rList.size(); i++ )
887  {
888  if ( rList[ i ].maName == aTemp )
889  break;
890  }
891  if ( i == rList.size() )
892  aSettingsName = aTemp;
893  }
894  while( aSettingsName.isEmpty() );
895 
896  setControlProperty( "ComboBox0Pg4", "Text", Any( aSettingsName ) );
897  setControlProperty( "RadioButton0Pg4", "Enabled", Any( !mbIsReadonly ) );
898  setControlProperty( "RadioButton1Pg4", "Enabled", Any( !mbIsReadonly ) );
899 
901 }
902 
903 
904 void OptimizerDialog::EnablePage( sal_Int16 nStep )
905 {
906  for( const auto& rItem : maControlPages[ nStep ] )
907  setControlProperty( rItem, "Enabled", Any( true ) );
908 }
909 void OptimizerDialog::DisablePage( sal_Int16 nStep )
910 {
911  for( const auto& rItem : maControlPages[ nStep ] )
912  setControlProperty( rItem, "Enabled", Any( false ) );
913 }
914 void OptimizerDialog::ActivatePage( sal_Int16 nStep )
915 {
916  for( const auto& rItem : maControlPages[ nStep ] )
917  setVisible( rItem, true );
918 }
919 void OptimizerDialog::DeactivatePage( sal_Int16 nStep )
920 {
921  for( const auto& rItem : maControlPages[ nStep ] )
922  setVisible( rItem, false );
923 }
924 
925 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define PAGE_WIDTH
#define PAGE_POS_Y
#define BUTTON_POS_Y
void EnablePage(sal_Int16 nStep)
css::uno::Any getControlProperty(const OUString &rControlName, const OUString &rPropertyName)
Definition: unodialog.cxx:279
bool bVisible
css::uno::Reference< css::awt::XTextListener > mxTextListenerComboBox0Pg1
static OUString ImpValueOfInMB(sal_Int64 rVal, sal_Unicode nSeparator)
std::vector< std::vector< OUString > > maControlPages
static OUString InsertRadioButton(OptimizerDialog &rOptimizerDialog, const OUString &rControlName, const Reference< XItemListener > &rItemListener, const OUString &rLabel, sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int16 nTabIndex)
static OUString InsertCheckBox(OptimizerDialog &rOptimizerDialog, const OUString &rControlName, const Reference< XItemListener > &xItemListener, const OUString &rLabel, sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int16 nTabIndex)
css::uno::Reference< css::awt::XListBox > insertListBox(const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:229
css::uno::Reference< css::awt::XActionListener > mxActionListenerListBox0Pg0
#define DIALOG_HEIGHT
void ActivatePage(sal_Int16 nStep)
static OUString InsertFixedText(OptimizerDialog &rOptimizerDialog, const OUString &rControlName, const OUString &rLabel, sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int32 nHeight, bool bMultiLine, bool bBold, sal_Int16 nTabIndex)
static OUString InsertSeparator(OptimizerDialog &rOptimizerDialog, const OUString &rControlName, sal_Int32 nOrientation, sal_Int32 nPosX, sal_Int32 nPosY, sal_Int32 nWidth, sal_Int32 nHeight)
static sal_Int64 GetFileSize(const OUString &rURL)
static void CountGraphics(const css::uno::Reference< css::uno::XComponentContext > &rxMSF, const css::uno::Reference< css::frame::XModel > &rxModel, const GraphicSettings &rGraphicSettings, sal_Int32 &rGraphics)
css::uno::Reference< css::awt::XControl > insertFormattedField(const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:178
sal_uInt16 sal_Unicode
void setControlProperty(const OUString &rControlName, const OUString &rPropertyName, const css::uno::Any &rPropertyValue)
Definition: unodialog.cxx:263
int nCount
#define BUTTON_HEIGHT
PPPOptimizerTokenEnum
static OUString InsertButton(OptimizerDialog &rOptimizerDialog, const OUString &rControlName, Reference< XActionListener > const &xActionListener, sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int16 nTabIndex, bool bEnabled, PPPOptimizerTokenEnum nResID, css::awt::PushButtonType nPushButtonType)
css::uno::Reference< css::awt::XItemListener > mxItemListener
#define SAL_N_ELEMENTS(arr)
css::uno::Reference< css::awt::XFixedText > insertFixedText(const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:144
OUString getString(const PPPOptimizerTokenEnum) const
void SetConfigProperty(const PPPOptimizerTokenEnum, const css::uno::Any &aValue)
void DeactivatePage(sal_Int16 nStep)
#define PAGE_POS_X
int i
sal_Int32 w
css::uno::Reference< css::awt::XComboBox > insertComboBox(const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:195
css::uno::Reference< css::awt::XRadioButton > insertRadioButton(const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:212
static OUString InsertListBox(OptimizerDialog &rOptimizerDialog, const OUString &rControlName, const Reference< XActionListener > &rActionListener, const bool bEnabled, const Sequence< OUString > &rItemList, sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth, sal_Int16 nTabIndex)
css::uno::Reference< css::uno::XComponentContext > mxContext
Definition: unodialog.hxx:98
css::uno::Reference< css::awt::XCheckBox > insertCheckBox(const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:161
static OUString InsertComboBox(OptimizerDialog &rOptimizerDialog, const OUString &rControlName, const Reference< XTextListener > &rTextListener, const bool bEnabled, const Sequence< OUString > &rItemList, sal_Int32 nXPos, sal_Int32 nYPos, sal_Int16 nTabIndex)
css::uno::Reference< css::awt::XTextListener > mxTextListenerFormattedField0Pg1
float v
void DisablePage(sal_Int16 nStep)
static void CollectMasterPages(const css::uno::Reference< css::frame::XModel > &, std::vector< MasterPageEntity > &)
static OUString InsertFormattedField(OptimizerDialog &rOptimizerDialog, const OUString &rControlName, const Reference< XTextListener > &xTextListener, const Reference< XSpinListener > &xSpinListener, sal_Int32 nXPos, sal_Int32 nYPos, double fEffectiveMin, double fEffectiveMax, sal_Int16 nTabIndex)
#define OD_DIALOG_WIDTH
const PropertyValue * pValues
css::uno::Reference< css::frame::XController > mxController
Definition: unodialog.hxx:99
css::uno::Reference< css::uno::XInterface > insertControlModel(const OUString &rServiceName, const OUString &rName, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:86
void setVisible(const OUString &rName, bool bVisible)
Definition: unodialog.cxx:104
OUString maName
std::vector< OptimizerSettings > & GetOptimizerSettings()
css::uno::Reference< css::awt::XSpinListener > mxSpinListenerFormattedField0Pg1
#define BUTTON_WIDTH
css::uno::Any GetConfigProperty(const PPPOptimizerTokenEnum) const
static void CollectCustomShowPages(const css::uno::Reference< css::frame::XModel > &, const OUString &rCustomShow, std::vector< css::uno::Reference< css::drawing::XDrawPage > > &)
css::uno::Reference< css::awt::XActionListener > mxActionListener
Reference< XModel > xModel
static void CollectNonCustomShowPages(const css::uno::Reference< css::frame::XModel > &, const OUString &rCustomShow, std::vector< css::uno::Reference< css::drawing::XDrawPage > > &)
static void SetBold(OptimizerDialog &rOptimizerDialog, const OUString &rControl)
aStr
css::uno::Reference< css::awt::XButton > insertButton(const OUString &rName, const css::uno::Reference< css::awt::XActionListener > &xActionListener, const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rPropertyValues)
Definition: unodialog.cxx:118