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