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  Reference< XShape > xShape( xShapes->getByIndex( j ), UNO_QUERY_THROW );
561  if ( xShape->getShapeType() == "com.sun.star.drawing.OLE2Shape" )
562  nOLECount++;
563  }
564  }
565 
566  std::vector< OUString > aControlList;
567  aControlList.push_back( InsertFixedText( *this, "FixedText0Pg2", getString( STR_OLE_OPTIMIZATION ), PAGE_POS_X, PAGE_POS_Y, PAGE_WIDTH, 8, false, true, mnTabIndex++ ) );
568  aControlList.push_back( InsertCheckBox( *this, "CheckBox0Pg2", mxItemListener, getString( STR_OLE_REPLACE ), PAGE_POS_X + 6, PAGE_POS_Y + 14, PAGE_WIDTH - 12, mnTabIndex++ ) );
569  aControlList.push_back( InsertRadioButton( *this, "RadioButton0Pg2", mxItemListener, getString( STR_ALL_OLE_OBJECTS ), PAGE_POS_X + 14, PAGE_POS_Y + 28, PAGE_WIDTH - 22, mnTabIndex++ ) );
570  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++ ) );
571  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++ ) );
572  maControlPages.push_back( aControlList );
573  DeactivatePage( 3 );
575 }
576 
577 
578 static OUString ImpValueOfInMB( sal_Int64 rVal, sal_Unicode nSeparator )
579 {
580  double fVal( static_cast<double>( rVal ) );
581  fVal /= ( 1 << 20 );
582  fVal += 0.05;
583  OUStringBuffer aVal( OUString::number( fVal ) );
584  sal_Int32 nX( OUString( aVal.getStr() ).indexOf( '.' ) );
585  if ( nX >= 0 )
586  {
587  aVal.setLength( nX + 2 );
588  aVal[nX] = nSeparator;
589  }
590  aVal.append( " MB" );
591  return aVal.makeStringAndClear();
592 }
593 
595 {
596  bool bSaveAs( GetConfigProperty( TK_SaveAs, true ) );
597  if ( mbIsReadonly )
598  {
599  setControlProperty( "RadioButton0Pg4", "State", Any( sal_Int16(false) ) );
600  setControlProperty( "RadioButton1Pg4", "State", Any( sal_Int16(true) ) );
601  }
602  else
603  {
604  setControlProperty( "RadioButton0Pg4", "State", Any( static_cast<sal_Int16>( !bSaveAs ) ) );
605  setControlProperty( "RadioButton1Pg4", "State", Any( static_cast<sal_Int16>(bSaveAs) ) );
606  }
607  setControlProperty( "ComboBox0Pg4", "Enabled", Any( false ) );
608 
609  Sequence< OUString > aItemList;
610  const std::vector< OptimizerSettings >& rList( GetOptimizerSettings() );
611  if ( rList.size() > 1 ) // the first session in the list is the actual one -> skipping first one
612  {
613  aItemList.realloc( rList.size() - 1 );
614  for ( std::vector<OptimizerSettings>::size_type w = 1; w < rList.size(); w++ )
615  aItemList[ w - 1 ] = rList[ w ].maName;
616  }
617  setControlProperty( "ComboBox0Pg4", "StringItemList", Any( aItemList ) );
618 
619  // now check if it is sensible to enable the combo box
620  bool bSaveSettingsEnabled = true;
621  if ( rList.size() > 1 ) // the first session in the list is the actual one -> skipping first one
622  {
623  for ( std::vector<OptimizerSettings>::size_type w = 1; w < rList.size(); w++ )
624  {
625  if ( rList[ w ] == rList[ 0 ] )
626  {
627  bSaveSettingsEnabled = false;
628  break;
629  }
630  }
631  }
632  sal_Int16 nInt16 = 0;
633  getControlProperty( "CheckBox1Pg4", "State" ) >>= nInt16;
634  setControlProperty( "CheckBox1Pg4", "Enabled", Any( bSaveSettingsEnabled ) );
635  setControlProperty( "ComboBox0Pg4", "Enabled", Any( bSaveSettingsEnabled && nInt16 ) );
636 
637  std::vector< OUString > aSummaryStrings;
638 
639  // taking care of deleted slides
640  sal_Int32 nDeletedSlides = 0;
641  OUString aCustomShowName;
642  if ( getControlProperty( "CheckBox3Pg3", "State" ) >>= nInt16 )
643  {
644  if ( nInt16 )
645  {
646  Sequence< short > aSelectedItems;
647  Sequence< OUString > aStringItemList;
648  Any aAny = getControlProperty( "ListBox0Pg3", "SelectedItems" );
649  if ( aAny >>= aSelectedItems )
650  {
651  if ( aSelectedItems.hasElements() )
652  {
653  sal_Int16 nSelectedItem = aSelectedItems[ 0 ];
654  aAny = getControlProperty( "ListBox0Pg3", "StringItemList" );
655  if ( aAny >>= aStringItemList )
656  {
657  if ( aStringItemList.getLength() > nSelectedItem )
658  SetConfigProperty( TK_CustomShowName, Any( aStringItemList[ nSelectedItem ] ) );
659  }
660  }
661  }
662  }
663  }
664  if ( !aCustomShowName.isEmpty() )
665  {
666  std::vector< Reference< XDrawPage > > vNonUsedPageList;
667  PageCollector::CollectNonCustomShowPages( mxController->getModel(), aCustomShowName, vNonUsedPageList );
668  nDeletedSlides += vNonUsedPageList.size();
669  }
671  {
672  if ( !aCustomShowName.isEmpty() )
673  {
674  std::vector< Reference< XDrawPage > > vUsedPageList;
675  PageCollector::CollectCustomShowPages( mxController->getModel(), aCustomShowName, vUsedPageList );
676  for( const auto& rxPage : vUsedPageList )
677  {
678  Reference< XPropertySet > xPropSet( rxPage, UNO_QUERY_THROW );
679  bool bVisible = true;
680  if ( xPropSet->getPropertyValue( "Visible" ) >>= bVisible )
681  {
682  if (!bVisible )
683  nDeletedSlides++;
684  }
685  }
686  }
687  else
688  {
689  Reference< XDrawPagesSupplier > xDrawPagesSupplier( mxController->getModel(), UNO_QUERY_THROW );
690  Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW );
691  for( sal_Int32 i = 0; i < xDrawPages->getCount(); i++ )
692  {
693  Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
694  Reference< XPropertySet > xPropSet( xDrawPage, UNO_QUERY_THROW );
695 
696  bool bVisible = true;
697  if ( xPropSet->getPropertyValue( "Visible" ) >>= bVisible )
698  {
699  if (!bVisible )
700  nDeletedSlides++;
701  }
702  }
703  }
704  }
706  {
707  std::vector< PageCollector::MasterPageEntity > aMasterPageList;
708  PageCollector::CollectMasterPages( mxController->getModel(), aMasterPageList );
709  Reference< XMasterPagesSupplier > xMasterPagesSupplier( mxController->getModel(), UNO_QUERY_THROW );
710  Reference< XDrawPages > xMasterPages( xMasterPagesSupplier->getMasterPages(), UNO_SET_THROW );
711  nDeletedSlides += std::count_if(aMasterPageList.begin(), aMasterPageList.end(),
712  [](const PageCollector::MasterPageEntity& rEntity) { return !rEntity.bUsed; });
713  }
714  if ( nDeletedSlides > 1 )
715  {
716  OUString aStr( getString( STR_DELETE_SLIDES ) );
717  OUString aPlaceholder( "%SLIDES" );
718  sal_Int32 i = aStr.indexOf( aPlaceholder );
719  if ( i >= 0 )
720  aStr = aStr.replaceAt( i, aPlaceholder.getLength(), OUString::number( nDeletedSlides ) );
721  aSummaryStrings.push_back( aStr );
722  }
723 
724 // generating graphic compression info
725  sal_Int32 nGraphics = 0;
726  bool bJPEGCompression( GetConfigProperty( TK_JPEGCompression, false ) );
727  sal_Int32 nJPEGQuality( GetConfigProperty( TK_JPEGQuality, sal_Int32(90) ) );
728  sal_Int32 nImageResolution( GetConfigProperty( TK_ImageResolution, sal_Int32(0) ) );
729  GraphicSettings aGraphicSettings( bJPEGCompression, nJPEGQuality, GetConfigProperty( TK_RemoveCropArea, false ),
730  nImageResolution, GetConfigProperty( TK_EmbedLinkedGraphics, true ) );
731  GraphicCollector::CountGraphics( UnoDialog::mxContext, mxController->getModel(), aGraphicSettings, nGraphics );
732  if ( nGraphics > 1 )
733  {
734  OUString aStr( getString( STR_OPTIMIZE_IMAGES ) );
735  OUString aImagePlaceholder( "%IMAGES" );
736  OUString aQualityPlaceholder( "%QUALITY" );
737  OUString aResolutionPlaceholder( "%RESOLUTION" );
738  sal_Int32 i = aStr.indexOf( aImagePlaceholder );
739  if ( i >= 0 )
740  aStr = aStr.replaceAt( i, aImagePlaceholder.getLength(), OUString::number( nGraphics ) );
741 
742  sal_Int32 j = aStr.indexOf( aQualityPlaceholder );
743  if ( j >= 0 )
744  aStr = aStr.replaceAt( j, aQualityPlaceholder.getLength(), OUString::number( nJPEGQuality ) );
745 
746  sal_Int32 k = aStr.indexOf( aResolutionPlaceholder );
747  if ( k >= 0 )
748  aStr = aStr.replaceAt( k, aResolutionPlaceholder.getLength(), OUString::number( nImageResolution ) );
749 
750  aSummaryStrings.push_back( aStr );
751  }
752 
753  if ( GetConfigProperty( TK_OLEOptimization, false ) )
754  {
755  sal_Int32 nOLEReplacements = 0;
756  Reference< XDrawPagesSupplier > xDrawPagesSupplier( mxController->getModel(), UNO_QUERY_THROW );
757  Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(), UNO_SET_THROW );
758  for ( sal_Int32 i = 0; i < xDrawPages->getCount(); i++ )
759  {
760  Reference< XShapes > xShapes( xDrawPages->getByIndex( i ), UNO_QUERY_THROW );
761  for ( sal_Int32 j = 0; j < xShapes->getCount(); j++ )
762  {
763  Reference< XShape > xShape( xShapes->getByIndex( j ), UNO_QUERY_THROW );
764  if ( xShape->getShapeType() == "com.sun.star.drawing.OLE2Shape" )
765  nOLEReplacements++;
766  }
767  }
768  if ( nOLEReplacements > 1 )
769  {
770  OUString aStr( getString( STR_CREATE_REPLACEMENT ) );
771  OUString aPlaceholder( "%OLE" );
772  sal_Int32 i = aStr.indexOf( aPlaceholder );
773  if ( i >= 0 )
774  aStr = aStr.replaceAt( i, aPlaceholder.getLength(), OUString::number( nOLEReplacements ) );
775  aSummaryStrings.push_back( aStr );
776  }
777  }
778  while( aSummaryStrings.size() < 3 )
779  aSummaryStrings.emplace_back( );
780  setControlProperty( "FixedText4Pg4", "Label", Any( aSummaryStrings[ 0 ] ) );
781  setControlProperty( "FixedText5Pg4", "Label", Any( aSummaryStrings[ 1 ] ) );
782  setControlProperty( "FixedText6Pg4", "Label", Any( aSummaryStrings[ 2 ] ) );
783 
784  sal_Int64 nCurrentFileSize = 0;
785  sal_Int64 nEstimatedFileSize = 0;
786  Reference< XStorable > xStorable( mxController->getModel(), UNO_QUERY );
787  if ( xStorable.is() && xStorable->hasLocation() )
788  nCurrentFileSize = PPPOptimizer::GetFileSize( xStorable->getLocation() );
789 
790  if ( nCurrentFileSize )
791  {
792  double fE = static_cast< double >( nCurrentFileSize );
793  if ( nImageResolution )
794  {
795  double v = ( static_cast< double >( nImageResolution ) + 75.0 ) / 300.0;
796  if ( v < 1.0 )
797  fE *= v;
798  }
799  if ( bJPEGCompression )
800  {
801  double v = 0.75 - ( ( 100.0 - static_cast< double >( nJPEGQuality ) ) / 400.0 ) ;
802  fE *= v;
803  }
804  nEstimatedFileSize = static_cast< sal_Int64 >( fE );
805  }
806  sal_Unicode nSeparator = '.';
807  OUString aStr( getString( STR_FILESIZESEPARATOR ) );
808  if ( !aStr.isEmpty() )
809  nSeparator = aStr[ 0 ];
810  setControlProperty( "FixedText7Pg4", "Label", Any( ImpValueOfInMB( nCurrentFileSize, nSeparator ) ) );
811  setControlProperty( "FixedText8Pg4", "Label", Any( ImpValueOfInMB( nEstimatedFileSize, nSeparator ) ) );
812  SetConfigProperty( TK_EstimatedFileSize, Any( nEstimatedFileSize ) );
813 }
814 
816 {
817  { // creating progress bar:
818  OUString pNames[] = {
819  OUString("Height"),
820  OUString("Name"),
821  OUString("PositionX"),
822  OUString("PositionY"),
823  OUString("ProgressValue"),
824  OUString("ProgressValueMax"),
825  OUString("ProgressValueMin"),
826  OUString("Width") };
827 
828  Any pValues[] = {
829  Any( sal_Int32(12) ),
830  Any( OUString("STR_SAVE_AS") ),
831  Any( sal_Int32( PAGE_POS_X + 6 ) ),
832  Any( sal_Int32( DIALOG_HEIGHT - 75 ) ),
833  Any( sal_Int32(0) ),
834  Any( sal_Int32(100) ),
835  Any( sal_Int32(0) ),
836  Any( sal_Int32( PAGE_WIDTH - 12 ) ) };
837 
838  sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
839 
840  Sequence< OUString > aNames( pNames, nCount );
841  Sequence< Any > aValues( pValues, nCount );
842 
843  insertControlModel( "com.sun.star.awt.UnoControlProgressBarModel",
844  "Progress", aNames, aValues );
845  }
846  Reference< XTextListener > xTextListener;
847  Sequence< OUString > aItemList;
848  std::vector< OUString > aControlList;
849  aControlList.push_back( InsertFixedText( *this, "FixedText0Pg4", getString( STR_SUMMARY_TITLE ), PAGE_POS_X, PAGE_POS_Y, PAGE_WIDTH, 8, false, true, mnTabIndex++ ) );
850 // aControlList.push_back( InsertSeparator( *this, "Separator0Pg4", 0, PAGE_POS_X + 6, PAGE_POS_Y + 90, PAGE_WIDTH - 12, 1 ) );
851 
852  aControlList.push_back( InsertFixedText( *this, "FixedText4Pg4", OUString(), PAGE_POS_X + 6, PAGE_POS_Y + 14, PAGE_WIDTH - 12, 8, false, false, mnTabIndex++ ) );
853  aControlList.push_back( InsertFixedText( *this, "FixedText5Pg4", OUString(), PAGE_POS_X + 6, PAGE_POS_Y + 22, PAGE_WIDTH - 12, 8, false, false, mnTabIndex++ ) );
854  aControlList.push_back( InsertFixedText( *this, "FixedText6Pg4", OUString(), PAGE_POS_X + 6, PAGE_POS_Y + 30, PAGE_WIDTH - 12, 8, false, false, mnTabIndex++ ) );
855 
856  aControlList.push_back( InsertFixedText( *this, "FixedText2Pg4", getString( STR_CURRENT_FILESIZE ), PAGE_POS_X + 6, PAGE_POS_Y + 50, 88, 8, false, false, mnTabIndex++ ) );
857  aControlList.push_back( InsertFixedText( *this, "FixedText7Pg4", OUString(), PAGE_POS_X + 100, PAGE_POS_Y + 50, 30, 8, false, false, mnTabIndex++ ) );
858  setControlProperty( "FixedText7Pg4", "Align", Any( static_cast< short >( 2 ) ) );
859  aControlList.push_back( InsertFixedText( *this, "FixedText3Pg4", getString( STR_ESTIMATED_FILESIZE ), PAGE_POS_X + 6, PAGE_POS_Y + 58, 88, 8, false, false, mnTabIndex++ ) );
860  aControlList.push_back( InsertFixedText( *this, "FixedText8Pg4", OUString(), PAGE_POS_X + 100, PAGE_POS_Y + 58, 30, 8, false, false, mnTabIndex++ ) );
861  setControlProperty( "FixedText8Pg4", "Align", Any( static_cast< short >( 2 ) ) );
862 
863  aControlList.push_back( InsertRadioButton( *this, "RadioButton0Pg4", mxItemListener, getString( STR_APPLY_TO_CURRENT ), PAGE_POS_X + 6, PAGE_POS_Y + 78, PAGE_WIDTH - 12, mnTabIndex++ ) );
864  aControlList.push_back( InsertRadioButton( *this, "RadioButton1Pg4", mxItemListener, getString( STR_SAVE_AS ), PAGE_POS_X + 6, PAGE_POS_Y + 90, PAGE_WIDTH - 12, mnTabIndex++ ) );
865  aControlList.push_back( InsertFixedText( *this, "FixedText1Pg4", OUString(), PAGE_POS_X + 6, DIALOG_HEIGHT - 87, PAGE_WIDTH - 12, 8, true, false, mnTabIndex++ ) );
866  aControlList.emplace_back("Progress" );
867  aControlList.push_back( InsertSeparator( *this, "Separator1Pg4", 0, PAGE_POS_X + 6, DIALOG_HEIGHT - 58, PAGE_WIDTH - 12, 1 ) );
868  aControlList.push_back( InsertCheckBox( *this, "CheckBox1Pg4", mxItemListener, getString( STR_SAVE_SETTINGS ), PAGE_POS_X + 6, DIALOG_HEIGHT - 47, 100, mnTabIndex++ ) );
869  aControlList.push_back( InsertComboBox( *this, "ComboBox0Pg4", xTextListener, true, aItemList, PAGE_POS_X + 106, DIALOG_HEIGHT - 48, mnTabIndex++ ) );
870  maControlPages.push_back( aControlList );
871  DeactivatePage( 4 );
872 
873  // creating a default session name that hasn't been used yet
874  OUString aSettingsName;
875  OUString aDefault( getString( STR_MY_SETTINGS ) );
876  sal_Int32 nSession = 1;
877  std::vector<OptimizerSettings>::size_type i;
878  const std::vector< OptimizerSettings >& rList( GetOptimizerSettings() );
879  do
880  {
881  OUString aTemp( aDefault.concat( OUString::number( nSession++ ) ) );
882  for ( i = 1; i < rList.size(); i++ )
883  {
884  if ( rList[ i ].maName == aTemp )
885  break;
886  }
887  if ( i == rList.size() )
888  aSettingsName = aTemp;
889  }
890  while( aSettingsName.isEmpty() );
891 
892  setControlProperty( "ComboBox0Pg4", "Text", Any( aSettingsName ) );
893  setControlProperty( "RadioButton0Pg4", "Enabled", Any( !mbIsReadonly ) );
894  setControlProperty( "RadioButton1Pg4", "Enabled", Any( !mbIsReadonly ) );
895 
897 }
898 
899 
900 void OptimizerDialog::EnablePage( sal_Int16 nStep )
901 {
902  for( const auto& rItem : maControlPages[ nStep ] )
903  setControlProperty( rItem, "Enabled", Any( true ) );
904 }
905 void OptimizerDialog::DisablePage( sal_Int16 nStep )
906 {
907  for( const auto& rItem : maControlPages[ nStep ] )
908  setControlProperty( rItem, "Enabled", Any( false ) );
909 }
910 void OptimizerDialog::ActivatePage( sal_Int16 nStep )
911 {
912  for( const auto& rItem : maControlPages[ nStep ] )
913  setVisible( rItem, true );
914 }
915 void OptimizerDialog::DeactivatePage( sal_Int16 nStep )
916 {
917  for( const auto& rItem : maControlPages[ nStep ] )
918  setVisible( rItem, false );
919 }
920 
921 /* 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
int i
void SetConfigProperty(const PPPOptimizerTokenEnum, const css::uno::Any &aValue)
void DeactivatePage(sal_Int16 nStep)
#define PAGE_POS_X
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