2010-10-12 15:55:21 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2012-10-01 16:08:38 +01:00
|
|
|
/*
|
|
|
|
* This file is part of the LibreOffice project.
|
|
|
|
*
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* This file incorporates work covered by the following license notice:
|
|
|
|
*
|
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed
|
|
|
|
* with this work for additional information regarding copyright
|
|
|
|
* ownership. The ASF licenses this file to you under the Apache
|
|
|
|
* License, Version 2.0 (the "License"); you may not use this file
|
|
|
|
* except in compliance with the License. You may obtain a copy of
|
|
|
|
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
|
|
|
*/
|
2007-05-11 13:01:25 +00:00
|
|
|
|
2008-08-29 09:11:21 +00:00
|
|
|
|
2007-05-11 13:01:25 +00:00
|
|
|
#include "optimizerdialog.hxx"
|
2013-10-14 12:12:54 +02:00
|
|
|
#include "pppoptimizer.hxx"
|
2007-05-11 13:01:25 +00:00
|
|
|
#include "fileopendialog.hxx"
|
|
|
|
#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
|
|
|
|
#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
|
|
|
|
#include <com/sun/star/io/XInputStream.hpp>
|
|
|
|
#include <com/sun/star/util/XCloseBroadcaster.hpp>
|
|
|
|
#include <com/sun/star/frame/XComponentLoader.hpp>
|
|
|
|
#include <com/sun/star/frame/XLayoutManager.hpp>
|
2010-12-03 13:59:22 +00:00
|
|
|
#include <sal/macros.h>
|
2007-05-11 13:01:25 +00:00
|
|
|
#include <osl/time.h>
|
|
|
|
|
|
|
|
// -------------------
|
|
|
|
// - OPTIMIZERDIALOG -
|
|
|
|
// -------------------
|
|
|
|
|
|
|
|
using namespace ::rtl;
|
|
|
|
using namespace ::com::sun::star::io;
|
|
|
|
using namespace ::com::sun::star::ui;
|
|
|
|
using namespace ::com::sun::star::awt;
|
|
|
|
using namespace ::com::sun::star::ucb;
|
|
|
|
using namespace ::com::sun::star::uno;
|
|
|
|
using namespace ::com::sun::star::util;
|
|
|
|
using namespace ::com::sun::star::lang;
|
|
|
|
using namespace ::com::sun::star::frame;
|
|
|
|
using namespace ::com::sun::star::beans;
|
|
|
|
using namespace ::com::sun::star::script;
|
|
|
|
using namespace ::com::sun::star::container;
|
|
|
|
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void OptimizerDialog::InitDialog()
|
|
|
|
{
|
|
|
|
// setting the dialog properties
|
Revert "fdo#46808, Convert awt::UnoControlDialogModel to new style"
This reverts commit 6c61b20a8d4a6dcac28801cde82a211fb7e30654. As discussed at
<http://lists.freedesktop.org/archives/libreoffice/2013-May/052449.html> "Re:
fdo#46808, Convert awt::UnoControlDialogModel to new style problem" why the odd
change in 2e2a4827ce6708f0e8677dba9cc92e1479a44086 "scripting: get
CreateUnoDialog() work again" appears to fix things again:
The problem is that the implementation of the css.awt.UnoControlDialogModel
involves UNO aggregation
(IMPL_CREATE_INSTANCE_WITH_GEOMETRY(UnoControlDialogModel) in
toolkit/soruce/helper/registerservices.cxx creating a
OGeometryControlModel<UnoControlDialogModel> instance that aggregates a
UnoControlDialogModel instance). That means that queryInterface can return a
reference to something that is technically a different object, and that's
what's happening here, and explains why calling setPropertyValue in two
different ways on what logically appears to be a single object can end up
calling two different implementations (of two different physical objects).
(UNO aggregation is known to be broken and should not be used. Nevertheless,
there's still code that does---code that is a horrible mess and hard to clean
up.)
That all this worked as intended in the past is just sheer luck, but any
way of substantially touching it is asking for trouble. I'm going to
revert 6c61b20a8d4a6dcac28801cde82a211fb7e30654 again.
I wasn't able to revert without also reverting
be50ad28f5bbdaeff527f646481ce263843c2401 "fdo#46808, Convert
awt::XUnoControlDialog to new style," as the two were tightly dependant. Also
reverts all the follow-up fixes cb4b6dde8fda2a5848e11063028bf44d72f85431
"-Werror,-Wuninitialized" (sans the const-ness fix in
UpdateHandler::insertControlModel), 697a007c61b9cabceb9767fad87cd5822b300452
"Fix exception specifications," 2ce6828bbbf6ba181bb2276adeec279e74151ef6 "fix
awt::UnoControlModelDialog crash," and 2e2a4827ce6708f0e8677dba9cc92e1479a44086
"scripting: get CreateUnoDialog() work again."
Conflicts:
basctl/source/dlged/dlged.cxx
filter/source/t602/t602filter.cxx
xmlscript/test/imexp.cxx
Change-Id: I5d133468062f3ca36300db52fbd699be1ac72998
2013-05-24 22:44:30 +02:00
|
|
|
OUString pNames[] = {
|
2013-10-15 16:59:36 +02:00
|
|
|
OUString("Closeable"),
|
|
|
|
OUString("Height"),
|
|
|
|
OUString("Moveable"),
|
|
|
|
OUString("PositionX"),
|
|
|
|
OUString("PositionY"),
|
|
|
|
OUString("Title"),
|
|
|
|
OUString("Width") };
|
Revert "fdo#46808, Convert awt::UnoControlDialogModel to new style"
This reverts commit 6c61b20a8d4a6dcac28801cde82a211fb7e30654. As discussed at
<http://lists.freedesktop.org/archives/libreoffice/2013-May/052449.html> "Re:
fdo#46808, Convert awt::UnoControlDialogModel to new style problem" why the odd
change in 2e2a4827ce6708f0e8677dba9cc92e1479a44086 "scripting: get
CreateUnoDialog() work again" appears to fix things again:
The problem is that the implementation of the css.awt.UnoControlDialogModel
involves UNO aggregation
(IMPL_CREATE_INSTANCE_WITH_GEOMETRY(UnoControlDialogModel) in
toolkit/soruce/helper/registerservices.cxx creating a
OGeometryControlModel<UnoControlDialogModel> instance that aggregates a
UnoControlDialogModel instance). That means that queryInterface can return a
reference to something that is technically a different object, and that's
what's happening here, and explains why calling setPropertyValue in two
different ways on what logically appears to be a single object can end up
calling two different implementations (of two different physical objects).
(UNO aggregation is known to be broken and should not be used. Nevertheless,
there's still code that does---code that is a horrible mess and hard to clean
up.)
That all this worked as intended in the past is just sheer luck, but any
way of substantially touching it is asking for trouble. I'm going to
revert 6c61b20a8d4a6dcac28801cde82a211fb7e30654 again.
I wasn't able to revert without also reverting
be50ad28f5bbdaeff527f646481ce263843c2401 "fdo#46808, Convert
awt::XUnoControlDialog to new style," as the two were tightly dependant. Also
reverts all the follow-up fixes cb4b6dde8fda2a5848e11063028bf44d72f85431
"-Werror,-Wuninitialized" (sans the const-ness fix in
UpdateHandler::insertControlModel), 697a007c61b9cabceb9767fad87cd5822b300452
"Fix exception specifications," 2ce6828bbbf6ba181bb2276adeec279e74151ef6 "fix
awt::UnoControlModelDialog crash," and 2e2a4827ce6708f0e8677dba9cc92e1479a44086
"scripting: get CreateUnoDialog() work again."
Conflicts:
basctl/source/dlged/dlged.cxx
filter/source/t602/t602filter.cxx
xmlscript/test/imexp.cxx
Change-Id: I5d133468062f3ca36300db52fbd699be1ac72998
2013-05-24 22:44:30 +02:00
|
|
|
|
|
|
|
Any pValues[] = {
|
|
|
|
Any( sal_True ),
|
|
|
|
Any( sal_Int32( DIALOG_HEIGHT ) ),
|
|
|
|
Any( sal_True ),
|
|
|
|
Any( sal_Int32( 200 ) ),
|
|
|
|
Any( sal_Int32( 52 ) ),
|
|
|
|
Any( getString( STR_SUN_OPTIMIZATION_WIZARD2 ) ),
|
|
|
|
Any( sal_Int32( OD_DIALOG_WIDTH ) ) };
|
|
|
|
|
|
|
|
sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
|
|
|
|
|
|
|
|
Sequence< OUString > aNames( pNames, nCount );
|
|
|
|
Sequence< Any > aValues( pValues, nCount );
|
|
|
|
|
|
|
|
mxDialogModelMultiPropertySet->setPropertyValues( aNames, aValues );
|
2007-05-11 13:01:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void OptimizerDialog::InitRoadmap()
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
OUString pNames[] = {
|
2013-10-15 16:59:36 +02:00
|
|
|
OUString("Height"),
|
|
|
|
OUString("PositionX"),
|
|
|
|
OUString("PositionY"),
|
|
|
|
OUString("Step"),
|
|
|
|
OUString("TabIndex"),
|
|
|
|
OUString("Width") };
|
2007-05-11 13:01:25 +00:00
|
|
|
|
|
|
|
Any pValues[] = {
|
|
|
|
Any( sal_Int32( DIALOG_HEIGHT - 26 ) ),
|
|
|
|
Any( sal_Int32( 0 ) ),
|
|
|
|
Any( sal_Int32( 0 ) ),
|
|
|
|
Any( sal_Int32( 0 ) ),
|
|
|
|
Any( mnTabIndex++ ),
|
|
|
|
Any( sal_Int32( 85 ) ) };
|
|
|
|
|
2010-12-03 13:59:22 +00:00
|
|
|
sal_Int32 nCount = SAL_N_ELEMENTS( pNames );
|
2007-05-11 13:01:25 +00:00
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
Sequence< OUString > aNames( pNames, nCount );
|
2013-10-15 17:37:59 +02:00
|
|
|
Sequence< Any > aValues( pValues, nCount );
|
2007-05-11 13:01:25 +00:00
|
|
|
|
2012-06-02 13:45:57 -05:00
|
|
|
mxRoadmapControlModel = insertControlModel( OUString( "com.sun.star.awt.UnoControlRoadmapModel" ),
|
2013-10-14 22:14:14 +02:00
|
|
|
"rdmNavi", aNames, aValues );
|
2007-05-11 13:01:25 +00:00
|
|
|
|
|
|
|
Reference< XPropertySet > xPropertySet( mxRoadmapControlModel, UNO_QUERY_THROW );
|
2013-10-14 22:14:14 +02:00
|
|
|
xPropertySet->setPropertyValue( "Name", Any( OUString("rdmNavi") ) );
|
|
|
|
mxRoadmapControl = mxDialog->getControl( "rdmNavi" );
|
2007-05-11 13:01:25 +00:00
|
|
|
InsertRoadmapItem( 0, sal_True, getString( STR_INTRODUCTION ), ITEM_ID_INTRODUCTION );
|
|
|
|
InsertRoadmapItem( 1, sal_True, getString( STR_SLIDES ), ITEM_ID_SLIDES );
|
|
|
|
InsertRoadmapItem( 2, sal_True, getString( STR_IMAGE_OPTIMIZATION ), ITEM_ID_GRAPHIC_OPTIMIZATION );
|
|
|
|
InsertRoadmapItem( 3, sal_True, getString( STR_OLE_OBJECTS ), ITEM_ID_OLE_OPTIMIZATION );
|
|
|
|
InsertRoadmapItem( 4, sal_True, getString( STR_SUMMARY ), ITEM_ID_SUMMARY );
|
|
|
|
|
2013-10-15 17:37:59 +02:00
|
|
|
// Well, that's messy, but the
|
|
|
|
// BMP_PRESENTATION_MINIMIZER from sd module cannot be used here directly
|
|
|
|
// that UNO wizard dialog should be converted to ui
|
|
|
|
OUString sURL( "private:graphicrepository/sd/res/minimize_presi_80.png" );
|
2007-05-11 13:01:25 +00:00
|
|
|
|
2013-10-14 22:14:14 +02:00
|
|
|
xPropertySet->setPropertyValue( "ImageURL", Any( sURL ) );
|
|
|
|
xPropertySet->setPropertyValue( "Activated", Any( (sal_Bool)sal_True ) );
|
|
|
|
xPropertySet->setPropertyValue( "Complete", Any( (sal_Bool)sal_True ) );
|
|
|
|
xPropertySet->setPropertyValue( "CurrentItemID", Any( (sal_Int16)ITEM_ID_INTRODUCTION ) );
|
|
|
|
xPropertySet->setPropertyValue( "Text", Any( getString( STR_STEPS ) ) );
|
2007-05-11 13:01:25 +00:00
|
|
|
}
|
|
|
|
catch( Exception& )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2013-04-07 12:06:47 +02:00
|
|
|
void OptimizerDialog::InsertRoadmapItem( const sal_Int32 nIndex, const sal_Bool bEnabled, const OUString& rLabel, const sal_Int32 nItemID )
|
2007-05-11 13:01:25 +00:00
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
Reference< XSingleServiceFactory > xSFRoadmap( mxRoadmapControlModel, UNO_QUERY_THROW );
|
|
|
|
Reference< XIndexContainer > aIndexContainerRoadmap( mxRoadmapControlModel, UNO_QUERY_THROW );
|
|
|
|
Reference< XInterface > xRoadmapItem( xSFRoadmap->createInstance(), UNO_QUERY_THROW );
|
|
|
|
Reference< XPropertySet > xPropertySet( xRoadmapItem, UNO_QUERY_THROW );
|
2013-10-14 22:14:14 +02:00
|
|
|
xPropertySet->setPropertyValue( "Label", Any( rLabel ) );
|
|
|
|
xPropertySet->setPropertyValue( "Enabled", Any( bEnabled ) );
|
|
|
|
xPropertySet->setPropertyValue( "ID", Any( nItemID ) );
|
2007-05-11 13:01:25 +00:00
|
|
|
aIndexContainerRoadmap->insertByIndex( nIndex, Any( xRoadmapItem ) );
|
|
|
|
}
|
|
|
|
catch( Exception& )
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void OptimizerDialog::UpdateConfiguration()
|
|
|
|
{
|
2007-10-29 11:30:01 +00:00
|
|
|
sal_Int16 nInt16 = 0;
|
2007-05-11 13:01:25 +00:00
|
|
|
Any aAny;
|
|
|
|
|
|
|
|
Sequence< sal_Int16 > aSelectedItems;
|
|
|
|
Sequence< OUString > aStringItemList;
|
|
|
|
|
|
|
|
// page0
|
2013-10-14 22:14:14 +02:00
|
|
|
aAny = getControlProperty( "ListBox0Pg0", "SelectedItems" );
|
2007-05-11 13:01:25 +00:00
|
|
|
if ( aAny >>= aSelectedItems )
|
|
|
|
{
|
|
|
|
if ( aSelectedItems.getLength() )
|
|
|
|
{
|
|
|
|
sal_Int16 nSelectedItem = aSelectedItems[ 0 ];
|
2013-10-14 22:14:14 +02:00
|
|
|
aAny = getControlProperty( "ListBox0Pg0", "StringItemList" );
|
2007-05-11 13:01:25 +00:00
|
|
|
if ( aAny >>= aStringItemList )
|
|
|
|
{
|
|
|
|
if ( aStringItemList.getLength() > nSelectedItem )
|
|
|
|
SetConfigProperty( TK_Name, Any( aStringItemList[ nSelectedItem ] ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-10-14 22:14:14 +02:00
|
|
|
aAny = getControlProperty( "CheckBox3Pg3", "State" );
|
2007-05-11 13:01:25 +00:00
|
|
|
if ( aAny >>= nInt16 )
|
|
|
|
{
|
|
|
|
if ( nInt16 )
|
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
aAny = getControlProperty( "ListBox0Pg3", "SelectedItems" );
|
2007-05-11 13:01:25 +00:00
|
|
|
if ( aAny >>= aSelectedItems )
|
|
|
|
{
|
|
|
|
if ( aSelectedItems.getLength() )
|
|
|
|
{
|
|
|
|
sal_Int16 nSelectedItem = aSelectedItems[ 0 ];
|
2013-10-14 22:14:14 +02:00
|
|
|
aAny = getControlProperty( "ListBox0Pg3", "StringItemList" );
|
2007-05-11 13:01:25 +00:00
|
|
|
if ( aAny >>= aStringItemList )
|
|
|
|
{
|
|
|
|
if ( aStringItemList.getLength() > nSelectedItem )
|
|
|
|
SetConfigProperty( TK_CustomShowName, Any( aStringItemList[ nSelectedItem ] ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2013-06-05 11:34:13 +02:00
|
|
|
OptimizerDialog::OptimizerDialog( const Reference< XComponentContext > &rxContext, Reference< XFrame >& rxFrame, Reference< XDispatch > rxStatusDispatcher ) :
|
|
|
|
UnoDialog( rxContext, rxFrame ),
|
|
|
|
ConfigurationAccess( rxContext, NULL ),
|
2007-05-11 13:01:25 +00:00
|
|
|
mnCurrentStep( 0 ),
|
|
|
|
mnTabIndex( 0 ),
|
2013-06-05 11:34:13 +02:00
|
|
|
mxContext( rxContext ),
|
2007-05-11 13:01:25 +00:00
|
|
|
mxFrame( rxFrame ),
|
|
|
|
mxItemListener( new ItemListener( *this ) ),
|
|
|
|
mxActionListener( new ActionListener( *this ) ),
|
|
|
|
mxActionListenerListBox0Pg0( new ActionListenerListBox0Pg0( *this ) ),
|
|
|
|
mxTextListenerFormattedField0Pg1( new TextListenerFormattedField0Pg1( *this ) ),
|
|
|
|
mxTextListenerComboBox0Pg1( new TextListenerComboBox0Pg1( *this ) ),
|
2007-08-16 13:33:00 +00:00
|
|
|
mxSpinListenerFormattedField0Pg1( new SpinListenerFormattedField0Pg1( *this ) ),
|
2007-05-11 13:01:25 +00:00
|
|
|
mxStatusDispatcher( rxStatusDispatcher )
|
|
|
|
{
|
|
|
|
Reference< XStorable > xStorable( mxController->getModel(), UNO_QUERY_THROW );
|
|
|
|
mbIsReadonly = xStorable->isReadonly();
|
|
|
|
|
|
|
|
InitDialog();
|
|
|
|
InitRoadmap();
|
|
|
|
InitNavigationBar();
|
|
|
|
InitPage0();
|
|
|
|
InitPage1();
|
|
|
|
InitPage2();
|
|
|
|
InitPage3();
|
|
|
|
InitPage4();
|
|
|
|
ActivatePage( 0 );
|
|
|
|
|
|
|
|
OptimizationStats aStats;
|
|
|
|
aStats.InitializeStatusValuesFromDocument( mxController->getModel() );
|
|
|
|
Sequence< PropertyValue > aStatusSequence( aStats.GetStatusSequence() );
|
|
|
|
UpdateStatus( aStatusSequence );
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
OptimizerDialog::~OptimizerDialog()
|
|
|
|
{
|
|
|
|
// not saving configuration if the dialog has been finished via cancel or close window
|
|
|
|
if ( mbStatus )
|
|
|
|
SaveConfiguration();
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
sal_Bool OptimizerDialog::execute()
|
|
|
|
{
|
|
|
|
Reference< XItemEventBroadcaster > maRoadmapBroadcaster( mxRoadmapControl, UNO_QUERY_THROW );
|
|
|
|
maRoadmapBroadcaster->addItemListener( mxItemListener );
|
|
|
|
UnoDialog::execute();
|
|
|
|
UpdateConfiguration(); // taking actual control settings for the configuration
|
|
|
|
maRoadmapBroadcaster->removeItemListener( mxItemListener );
|
|
|
|
return mbStatus;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void OptimizerDialog::SwitchPage( sal_Int16 nNewStep )
|
|
|
|
{
|
2012-03-20 14:21:22 +01:00
|
|
|
if ( ( nNewStep != mnCurrentStep ) && ( nNewStep <= MAX_STEP ) && ( nNewStep >= 0 ) )
|
2007-05-11 13:01:25 +00:00
|
|
|
{
|
|
|
|
sal_Int16 nOldStep = mnCurrentStep;
|
|
|
|
if ( nNewStep == 0 )
|
2013-10-14 22:14:14 +02:00
|
|
|
disableControl( "btnNavBack" );
|
2007-05-11 13:01:25 +00:00
|
|
|
else if ( nOldStep == 0 )
|
2013-10-14 22:14:14 +02:00
|
|
|
enableControl( "btnNavBack" );
|
2007-05-11 13:01:25 +00:00
|
|
|
|
|
|
|
if ( nNewStep == MAX_STEP )
|
2013-10-14 22:14:14 +02:00
|
|
|
disableControl( "btnNavNext" );
|
2007-05-11 13:01:25 +00:00
|
|
|
else if ( nOldStep == MAX_STEP )
|
2013-10-14 22:14:14 +02:00
|
|
|
enableControl( "btnNavNext" );
|
2007-05-11 13:01:25 +00:00
|
|
|
|
2013-10-14 22:14:14 +02:00
|
|
|
setControlProperty( "rdmNavi", "CurrentItemID", Any( nNewStep ) );
|
2007-05-11 13:01:25 +00:00
|
|
|
|
|
|
|
DeactivatePage( nOldStep );
|
|
|
|
UpdateControlStates( nNewStep );
|
|
|
|
|
|
|
|
ActivatePage( nNewStep );
|
|
|
|
mnCurrentStep = nNewStep;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void OptimizerDialog::UpdateControlStates( sal_Int16 nPage )
|
|
|
|
{
|
|
|
|
switch( nPage )
|
|
|
|
{
|
|
|
|
case 0 : UpdateControlStatesPage0(); break;
|
|
|
|
case 1 : UpdateControlStatesPage1(); break;
|
|
|
|
case 2 : UpdateControlStatesPage2(); break;
|
|
|
|
case 3 : UpdateControlStatesPage3(); break;
|
|
|
|
case 4 : UpdateControlStatesPage4(); break;
|
|
|
|
default:
|
|
|
|
{
|
|
|
|
UpdateControlStatesPage0();
|
|
|
|
UpdateControlStatesPage1();
|
|
|
|
UpdateControlStatesPage2();
|
|
|
|
UpdateControlStatesPage3();
|
|
|
|
UpdateControlStatesPage4();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2013-10-14 22:37:15 +02:00
|
|
|
OUString OptimizerDialog::GetSelectedString( OUString const & token )
|
2007-05-11 13:01:25 +00:00
|
|
|
{
|
|
|
|
OUString aSelectedItem;
|
|
|
|
Sequence< sal_Int16 > sSelectedItems;
|
|
|
|
Sequence< OUString > sItemList;
|
|
|
|
|
2013-10-14 22:37:15 +02:00
|
|
|
if ( ( getControlProperty( token, "SelectedItems" ) >>= sSelectedItems ) &&
|
|
|
|
( getControlProperty( token, "StringItemList" ) >>= sItemList ) )
|
2007-05-11 13:01:25 +00:00
|
|
|
{
|
|
|
|
if ( sSelectedItems.getLength() == 1 )
|
|
|
|
{
|
|
|
|
sal_Int16 nSelectedItem = sSelectedItems[ 0 ];
|
|
|
|
if ( nSelectedItem < sItemList.getLength() )
|
|
|
|
aSelectedItem = sItemList[ nSelectedItem ];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return aSelectedItem;
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void OptimizerDialog::UpdateStatus( const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& rStatus )
|
|
|
|
{
|
|
|
|
if ( mxReschedule.is() )
|
|
|
|
{
|
|
|
|
maStats.InitializeStatusValues( rStatus );
|
|
|
|
const Any* pVal( maStats.GetStatusValue( TK_Status ) );
|
|
|
|
if ( pVal )
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString sStatus;
|
2007-05-11 13:01:25 +00:00
|
|
|
if ( *pVal >>= sStatus )
|
2007-08-15 15:38:45 +00:00
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
setControlProperty( "FixedText1Pg4", "Enabled", Any( sal_True ) );
|
|
|
|
setControlProperty( "FixedText1Pg4", "Label", Any( getString( TKGet( sStatus ) ) ) );
|
2007-08-15 15:38:45 +00:00
|
|
|
}
|
2007-05-11 13:01:25 +00:00
|
|
|
}
|
|
|
|
pVal = maStats.GetStatusValue( TK_Progress );
|
|
|
|
if ( pVal )
|
|
|
|
{
|
|
|
|
sal_Int32 nProgress = 0;
|
|
|
|
if ( *pVal >>= nProgress )
|
2013-10-14 22:14:14 +02:00
|
|
|
setControlProperty( "Progress", "ProgressValue", Any( nProgress ) );
|
2007-05-11 13:01:25 +00:00
|
|
|
}
|
2007-08-16 16:12:26 +00:00
|
|
|
pVal = maStats.GetStatusValue( TK_OpenNewDocument );
|
|
|
|
if ( pVal )
|
|
|
|
SetConfigProperty( TK_OpenNewDocument, *pVal );
|
|
|
|
|
2007-05-11 13:01:25 +00:00
|
|
|
mxReschedule->reschedule();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ItemListener::itemStateChanged( const ItemEvent& Event )
|
|
|
|
throw ( RuntimeException )
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
sal_Int16 nState;
|
|
|
|
OUString aControlName;
|
|
|
|
Reference< XControl > xControl;
|
|
|
|
Any aSource( Event.Source );
|
|
|
|
if ( aSource >>= xControl )
|
|
|
|
{
|
|
|
|
Reference< XPropertySet > xPropertySet( xControl->getModel(), UNO_QUERY_THROW );
|
2013-10-14 22:14:14 +02:00
|
|
|
xPropertySet->getPropertyValue( "Name" ) >>= aControlName;
|
2007-05-11 13:01:25 +00:00
|
|
|
PPPOptimizerTokenEnum eControl( TKGet( aControlName ) );
|
|
|
|
switch( eControl )
|
|
|
|
{
|
|
|
|
case TK_rdmNavi :
|
|
|
|
{
|
|
|
|
mrOptimizerDialog.SwitchPage( static_cast< sal_Int16 >( Event.ItemId ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_CheckBox1Pg1 :
|
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
if ( xPropertySet->getPropertyValue( "State" ) >>= nState )
|
2007-05-11 13:01:25 +00:00
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_RemoveCropArea, Any( nState != 0 ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_CheckBox2Pg1 :
|
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
if ( xPropertySet->getPropertyValue( "State" ) >>= nState )
|
2007-05-11 13:01:25 +00:00
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_EmbedLinkedGraphics, Any( nState != 0 ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_CheckBox0Pg2 :
|
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
if ( xPropertySet->getPropertyValue( "State" ) >>= nState )
|
2007-05-11 13:01:25 +00:00
|
|
|
{
|
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_OLEOptimization, Any( nState != 0 ) );
|
2013-10-14 22:14:14 +02:00
|
|
|
mrOptimizerDialog.setControlProperty( "RadioButton0Pg2", "Enabled", Any( nState != 0 ) );
|
|
|
|
mrOptimizerDialog.setControlProperty( "RadioButton1Pg2", "Enabled", Any( nState != 0 ) );
|
2007-05-11 13:01:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_RadioButton0Pg1 :
|
|
|
|
{
|
2007-10-29 11:30:01 +00:00
|
|
|
sal_Int16 nInt16 = 0;
|
2013-10-14 22:14:14 +02:00
|
|
|
if ( xPropertySet->getPropertyValue( "State" ) >>= nInt16 )
|
2007-05-11 13:01:25 +00:00
|
|
|
{
|
|
|
|
nInt16 ^= 1;
|
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_JPEGCompression, Any( nInt16 != 0 ) );
|
2013-10-14 22:14:14 +02:00
|
|
|
mrOptimizerDialog.setControlProperty( "FixedText1Pg1", "Enabled", Any( nInt16 != 0 ) );
|
|
|
|
mrOptimizerDialog.setControlProperty( "FormattedField0Pg1", "Enabled", Any( nInt16 != 0 ) );
|
2007-05-11 13:01:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_RadioButton1Pg1 :
|
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
if ( xPropertySet->getPropertyValue( "State" ) >>= nState )
|
2007-05-11 13:01:25 +00:00
|
|
|
{
|
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_JPEGCompression, Any( nState != 0 ) );
|
2013-10-14 22:14:14 +02:00
|
|
|
mrOptimizerDialog.setControlProperty( "FixedText1Pg1", "Enabled", Any( nState != 0 ) );
|
|
|
|
mrOptimizerDialog.setControlProperty( "FormattedField0Pg1", "Enabled", Any( nState != 0 ) );
|
2007-05-11 13:01:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_RadioButton0Pg2 :
|
|
|
|
{
|
|
|
|
sal_Int16 nInt16;
|
2013-10-14 22:14:14 +02:00
|
|
|
if ( xPropertySet->getPropertyValue( "State" ) >>= nInt16 )
|
2007-05-11 13:01:25 +00:00
|
|
|
{
|
|
|
|
nInt16 ^= 1;
|
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_OLEOptimizationType, Any( nInt16 ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_RadioButton1Pg2 :
|
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
if ( xPropertySet->getPropertyValue( "State" ) >>= nState )
|
2007-05-11 13:01:25 +00:00
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_OLEOptimizationType, Any( nState ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_CheckBox0Pg3 :
|
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
if ( xPropertySet->getPropertyValue( "State" ) >>= nState )
|
2007-05-11 13:01:25 +00:00
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_DeleteUnusedMasterPages, Any( nState != 0 ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_CheckBox1Pg3 :
|
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
if ( xPropertySet->getPropertyValue( "State" ) >>= nState )
|
2007-05-11 13:01:25 +00:00
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_DeleteNotesPages, Any( nState != 0 ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_CheckBox2Pg3 :
|
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
if ( xPropertySet->getPropertyValue( "State" ) >>= nState )
|
2007-05-11 13:01:25 +00:00
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_DeleteHiddenSlides, Any( nState != 0 ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_CheckBox3Pg3 :
|
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
if ( xPropertySet->getPropertyValue( "State" ) >>= nState )
|
|
|
|
mrOptimizerDialog.setControlProperty( "ListBox0Pg3", "Enabled", Any( nState != 0 ) );
|
2007-05-11 13:01:25 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_CheckBox1Pg4 :
|
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
if ( xPropertySet->getPropertyValue( "State" ) >>= nState )
|
|
|
|
mrOptimizerDialog.setControlProperty( "ComboBox0Pg4", "Enabled", Any( nState != 0 ) );
|
2007-05-11 13:01:25 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_RadioButton0Pg4 :
|
|
|
|
case TK_RadioButton1Pg4 :
|
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
if ( xPropertySet->getPropertyValue( "State" ) >>= nState )
|
2007-05-11 13:01:25 +00:00
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_SaveAs, Any( eControl == TK_RadioButton1Pg4 ? nState != 0 : nState == 0 ) );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
catch ( Exception& )
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void ItemListener::disposing( const ::com::sun::star::lang::EventObject& /* Source */ )
|
|
|
|
throw ( com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ActionListener::actionPerformed( const ActionEvent& rEvent )
|
|
|
|
throw ( com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
|
|
|
switch( TKGet( rEvent.ActionCommand ) )
|
|
|
|
{
|
|
|
|
case TK_btnNavBack : mrOptimizerDialog.SwitchPage( mrOptimizerDialog.mnCurrentStep - 1 ); break;
|
|
|
|
case TK_btnNavNext : mrOptimizerDialog.SwitchPage( mrOptimizerDialog.mnCurrentStep + 1 ); break;
|
|
|
|
case TK_btnNavFinish :
|
|
|
|
{
|
|
|
|
mrOptimizerDialog.UpdateConfiguration();
|
|
|
|
|
|
|
|
mrOptimizerDialog.SwitchPage( ITEM_ID_SUMMARY );
|
|
|
|
mrOptimizerDialog.DisablePage( ITEM_ID_SUMMARY );
|
2013-10-14 22:14:14 +02:00
|
|
|
mrOptimizerDialog.setControlProperty( "btnNavBack", "Enabled", Any( sal_False ) );
|
|
|
|
mrOptimizerDialog.setControlProperty( "btnNavNext", "Enabled", Any( sal_False ) );
|
|
|
|
mrOptimizerDialog.setControlProperty( "btnNavFinish", "Enabled", Any( sal_False ) );
|
|
|
|
mrOptimizerDialog.setControlProperty( "btnNavCancel", "Enabled", Any( sal_False ) );
|
|
|
|
mrOptimizerDialog.setControlProperty( "FixedText0Pg4", "Enabled", Any( sal_True ) );
|
2007-05-11 13:01:25 +00:00
|
|
|
|
|
|
|
// check if we have to open the FileDialog
|
|
|
|
sal_Bool bSuccessfullyExecuted = sal_True;
|
|
|
|
sal_Int16 nInt16 = 0;
|
2013-10-14 22:14:14 +02:00
|
|
|
mrOptimizerDialog.getControlProperty( "RadioButton1Pg4", "State" ) >>= nInt16;
|
2007-05-11 13:01:25 +00:00
|
|
|
if ( nInt16 )
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aSaveAsURL;
|
2013-06-05 11:34:13 +02:00
|
|
|
FileOpenDialog aFileOpenDialog( mrOptimizerDialog.GetComponentContext() );
|
2007-05-11 13:01:25 +00:00
|
|
|
|
|
|
|
// generating default file name
|
|
|
|
Reference< XStorable > xStorable( mrOptimizerDialog.mxController->getModel(), UNO_QUERY );
|
2007-08-17 08:38:07 +00:00
|
|
|
if ( xStorable.is() && xStorable->hasLocation() )
|
2007-05-11 13:01:25 +00:00
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aLocation( xStorable->getLocation() );
|
2012-01-09 11:57:52 -02:00
|
|
|
if ( !aLocation.isEmpty() )
|
2007-05-11 13:01:25 +00:00
|
|
|
{
|
2007-08-17 08:38:07 +00:00
|
|
|
sal_Int32 nIndex = aLocation.lastIndexOf( '/', aLocation.getLength() - 1 );
|
|
|
|
if ( nIndex >= 0 )
|
2007-05-11 13:01:25 +00:00
|
|
|
{
|
2007-08-17 08:38:07 +00:00
|
|
|
if ( nIndex < aLocation.getLength() - 1 )
|
|
|
|
aLocation = aLocation.copy( nIndex + 1 );
|
2007-05-11 13:01:25 +00:00
|
|
|
|
2007-08-17 08:38:07 +00:00
|
|
|
// remove extension
|
|
|
|
nIndex = aLocation.lastIndexOf( '.', aLocation.getLength() - 1 );
|
|
|
|
if ( nIndex >= 0 )
|
|
|
|
aLocation = aLocation.copy( 0, nIndex );
|
2007-05-11 13:01:25 +00:00
|
|
|
|
2007-08-17 08:38:07 +00:00
|
|
|
// adding .mini
|
2012-06-02 13:45:57 -05:00
|
|
|
aLocation = aLocation.concat( OUString(".mini") );
|
2007-08-17 08:38:07 +00:00
|
|
|
aFileOpenDialog.setDefaultName( aLocation );
|
2007-05-11 13:01:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
sal_Bool bDialogExecuted = aFileOpenDialog.execute() == dialogs::ExecutableDialogResults::OK;
|
|
|
|
if ( bDialogExecuted )
|
|
|
|
{
|
|
|
|
aSaveAsURL = aFileOpenDialog.getURL();
|
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_SaveAsURL, Any( aSaveAsURL ) );
|
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_FilterName, Any( aFileOpenDialog.getFilterName() ) );
|
|
|
|
}
|
2012-01-09 11:57:52 -02:00
|
|
|
if ( aSaveAsURL.isEmpty() )
|
2007-05-11 13:01:25 +00:00
|
|
|
{
|
|
|
|
// something goes wrong...
|
|
|
|
bSuccessfullyExecuted = sal_False;
|
|
|
|
}
|
|
|
|
|
|
|
|
// waiting for 500ms
|
|
|
|
if ( mrOptimizerDialog.mxReschedule.is() )
|
|
|
|
{
|
|
|
|
mrOptimizerDialog.mxReschedule->reschedule();
|
|
|
|
for ( sal_uInt32 i = osl_getGlobalTimer(); ( i + 500 ) > ( osl_getGlobalTimer() ); )
|
|
|
|
mrOptimizerDialog.mxReschedule->reschedule();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( bSuccessfullyExecuted )
|
|
|
|
{ // now check if we have to store a session template
|
|
|
|
nInt16 = 0;
|
|
|
|
OUString aSettingsName;
|
2013-10-14 22:14:14 +02:00
|
|
|
mrOptimizerDialog.getControlProperty( "CheckBox1Pg4", "State" ) >>= nInt16;
|
|
|
|
mrOptimizerDialog.getControlProperty( "ComboBox0Pg4", "Text" ) >>= aSettingsName;
|
2012-01-09 11:57:52 -02:00
|
|
|
if ( nInt16 && !aSettingsName.isEmpty() )
|
2007-05-11 13:01:25 +00:00
|
|
|
{
|
|
|
|
std::vector< OptimizerSettings >::iterator aIter( mrOptimizerDialog.GetOptimizerSettingsByName( aSettingsName ) );
|
|
|
|
std::vector< OptimizerSettings >& rSettings( mrOptimizerDialog.GetOptimizerSettings() );
|
|
|
|
OptimizerSettings aNewSettings( rSettings[ 0 ] );
|
|
|
|
aNewSettings.maName = aSettingsName;
|
|
|
|
if ( aIter == rSettings.end() )
|
|
|
|
rSettings.push_back( aNewSettings );
|
|
|
|
else
|
|
|
|
*aIter = aNewSettings;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( bSuccessfullyExecuted )
|
|
|
|
{
|
2013-10-14 12:12:54 +02:00
|
|
|
Reference < XDispatch > xDispatch(
|
|
|
|
new PPPOptimizer(
|
|
|
|
mrOptimizerDialog.GetComponentContext(),
|
|
|
|
mrOptimizerDialog.GetFrame()));
|
2007-05-11 13:01:25 +00:00
|
|
|
|
|
|
|
URL aURL;
|
2013-11-15 11:05:19 +02:00
|
|
|
aURL.Protocol = "vnd.com.sun.star.comp.PPPOptimizer:";
|
|
|
|
aURL.Path = "optimize";
|
2007-05-11 13:01:25 +00:00
|
|
|
|
|
|
|
Sequence< PropertyValue > lArguments( 3 );
|
2013-10-14 22:14:14 +02:00
|
|
|
lArguments[ 0 ].Name = "Settings";
|
2007-05-11 13:01:25 +00:00
|
|
|
lArguments[ 0 ].Value <<= mrOptimizerDialog.GetConfigurationSequence();
|
2013-10-14 22:14:14 +02:00
|
|
|
lArguments[ 1 ].Name = "StatusDispatcher";
|
2007-05-11 13:01:25 +00:00
|
|
|
lArguments[ 1 ].Value <<= mrOptimizerDialog.GetStatusDispatcher();
|
2013-10-14 22:14:14 +02:00
|
|
|
lArguments[ 2 ].Name = "InformationDialog";
|
2007-05-24 09:08:36 +00:00
|
|
|
lArguments[ 2 ].Value <<= mrOptimizerDialog.GetFrame();
|
2007-05-11 13:01:25 +00:00
|
|
|
|
2013-10-14 12:12:54 +02:00
|
|
|
xDispatch->dispatch( aURL, lArguments );
|
2007-05-11 13:01:25 +00:00
|
|
|
|
|
|
|
mrOptimizerDialog.endExecute( bSuccessfullyExecuted );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
mrOptimizerDialog.setControlProperty( "btnNavBack", "Enabled", Any( sal_True ) );
|
|
|
|
mrOptimizerDialog.setControlProperty( "btnNavNext", "Enabled", Any( sal_False ) );
|
|
|
|
mrOptimizerDialog.setControlProperty( "btnNavFinish", "Enabled", Any( sal_True ) );
|
|
|
|
mrOptimizerDialog.setControlProperty( "btnNavCancel", "Enabled", Any( sal_True ) );
|
2007-05-11 13:01:25 +00:00
|
|
|
mrOptimizerDialog.EnablePage( ITEM_ID_SUMMARY );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case TK_btnNavCancel : mrOptimizerDialog.endExecute( sal_False ); break;
|
|
|
|
case TK_Button0Pg0 : // delete configuration
|
|
|
|
{
|
2013-10-14 22:37:15 +02:00
|
|
|
OUString aSelectedItem( mrOptimizerDialog.GetSelectedString( "ListBox0Pg0" ) );
|
2012-01-09 11:57:52 -02:00
|
|
|
if ( !aSelectedItem.isEmpty() )
|
2007-05-11 13:01:25 +00:00
|
|
|
{
|
|
|
|
std::vector< OptimizerSettings >::iterator aIter( mrOptimizerDialog.GetOptimizerSettingsByName( aSelectedItem ) );
|
|
|
|
std::vector< OptimizerSettings >& rList( mrOptimizerDialog.GetOptimizerSettings() );
|
|
|
|
if ( aIter != rList.end() )
|
|
|
|
{
|
|
|
|
rList.erase( aIter );
|
|
|
|
mrOptimizerDialog.UpdateControlStates();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void ActionListener::disposing( const ::com::sun::star::lang::EventObject& /* Source */ )
|
|
|
|
throw ( com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void ActionListenerListBox0Pg0::actionPerformed( const ActionEvent& rEvent )
|
|
|
|
throw ( com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
2012-01-09 11:57:52 -02:00
|
|
|
if ( !rEvent.ActionCommand.isEmpty() )
|
2007-05-11 13:01:25 +00:00
|
|
|
{
|
|
|
|
std::vector< OptimizerSettings >::iterator aIter( mrOptimizerDialog.GetOptimizerSettingsByName( rEvent.ActionCommand ) );
|
|
|
|
std::vector< OptimizerSettings >& rList( mrOptimizerDialog.GetOptimizerSettings() );
|
|
|
|
if ( aIter != rList.end() )
|
|
|
|
rList[ 0 ] = *aIter;
|
|
|
|
}
|
|
|
|
mrOptimizerDialog.UpdateControlStates();
|
|
|
|
}
|
|
|
|
void ActionListenerListBox0Pg0::disposing( const ::com::sun::star::lang::EventObject& /* Source */ )
|
|
|
|
throw ( com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void TextListenerFormattedField0Pg1::textChanged( const TextEvent& /* rEvent */ )
|
|
|
|
throw ( com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
2007-10-29 11:30:01 +00:00
|
|
|
double fDouble = 0;
|
2013-10-14 22:14:14 +02:00
|
|
|
Any aAny = mrOptimizerDialog.getControlProperty( "FormattedField0Pg1", "EffectiveValue" );
|
2007-05-11 13:01:25 +00:00
|
|
|
if ( aAny >>= fDouble )
|
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_JPEGQuality, Any( (sal_Int32)fDouble ) );
|
|
|
|
}
|
|
|
|
void TextListenerFormattedField0Pg1::disposing( const ::com::sun::star::lang::EventObject& /* Source */ )
|
|
|
|
throw ( com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void TextListenerComboBox0Pg1::textChanged( const TextEvent& /* rEvent */ )
|
|
|
|
throw ( com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
2013-04-07 12:06:47 +02:00
|
|
|
OUString aString;
|
2013-10-14 22:14:14 +02:00
|
|
|
Any aAny = mrOptimizerDialog.getControlProperty( "ComboBox0Pg1", "Text" );
|
2007-05-11 13:01:25 +00:00
|
|
|
if ( aAny >>= aString )
|
|
|
|
{
|
|
|
|
sal_Int32 nI0, nI1, nI2, nI3, nI4;
|
|
|
|
nI0 = nI1 = nI2 = nI3 = nI4 = 0;
|
|
|
|
|
|
|
|
if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_0 ).getToken( 1, ';', nI0 ) == aString )
|
|
|
|
aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_0 ).getToken( 0, ';', nI4 );
|
|
|
|
else if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_1 ).getToken( 1, ';', nI1 ) == aString )
|
|
|
|
aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_1 ).getToken( 0, ';', nI4 );
|
|
|
|
else if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_2 ).getToken( 1, ';', nI2 ) == aString )
|
|
|
|
aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_2 ).getToken( 0, ';', nI4 );
|
|
|
|
else if ( mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_3 ).getToken( 1, ';', nI3 ) == aString )
|
|
|
|
aString = mrOptimizerDialog.getString( STR_IMAGE_RESOLUTION_3 ).getToken( 0, ';', nI4 );
|
|
|
|
|
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_ImageResolution, Any( aString.toInt32() ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void TextListenerComboBox0Pg1::disposing( const ::com::sun::star::lang::EventObject& /* Source */ )
|
|
|
|
throw ( com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
|
|
|
}
|
2007-08-16 13:33:00 +00:00
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SpinListenerFormattedField0Pg1::up( const SpinEvent& /* rEvent */ )
|
|
|
|
throw ( com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
|
|
|
double fDouble;
|
2013-10-14 22:14:14 +02:00
|
|
|
Any aAny = mrOptimizerDialog.getControlProperty( "FormattedField0Pg1", "EffectiveValue" );
|
2007-08-16 13:33:00 +00:00
|
|
|
if ( aAny >>= fDouble )
|
|
|
|
{
|
|
|
|
fDouble += 9;
|
|
|
|
if ( fDouble > 100 )
|
|
|
|
fDouble = 100;
|
2013-10-14 22:14:14 +02:00
|
|
|
mrOptimizerDialog.setControlProperty( "FormattedField0Pg1", "EffectiveValue", Any( fDouble ) );
|
2007-08-16 13:33:00 +00:00
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_JPEGQuality, Any( (sal_Int32)fDouble ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void SpinListenerFormattedField0Pg1::down( const SpinEvent& /* rEvent */ )
|
|
|
|
throw ( com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
|
|
|
double fDouble;
|
2013-10-14 22:14:14 +02:00
|
|
|
Any aAny = mrOptimizerDialog.getControlProperty( "FormattedField0Pg1", "EffectiveValue" );
|
2007-08-16 13:33:00 +00:00
|
|
|
if ( aAny >>= fDouble )
|
|
|
|
{
|
|
|
|
fDouble -= 9;
|
|
|
|
if ( fDouble < 0 )
|
|
|
|
fDouble = 0;
|
2013-10-14 22:14:14 +02:00
|
|
|
mrOptimizerDialog.setControlProperty( "FormattedField0Pg1", "EffectiveValue", Any( fDouble ) );
|
2007-08-16 13:33:00 +00:00
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_JPEGQuality, Any( (sal_Int32)fDouble ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
void SpinListenerFormattedField0Pg1::first( const SpinEvent& /* rEvent */ )
|
|
|
|
throw ( com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
mrOptimizerDialog.setControlProperty( "FormattedField0Pg1", "EffectiveValue", Any( static_cast< double >( 0 ) ) );
|
2007-08-16 13:33:00 +00:00
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_JPEGQuality, Any( (sal_Int32)0 ) );
|
|
|
|
}
|
|
|
|
void SpinListenerFormattedField0Pg1::last( const SpinEvent& /* rEvent */ )
|
|
|
|
throw ( com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
2013-10-14 22:14:14 +02:00
|
|
|
mrOptimizerDialog.setControlProperty( "FormattedField0Pg1", "EffectiveValue", Any( static_cast< double >( 100 ) ) );
|
2007-08-16 13:33:00 +00:00
|
|
|
mrOptimizerDialog.SetConfigProperty( TK_JPEGQuality, Any( (sal_Int32)100 ) );
|
|
|
|
}
|
|
|
|
void SpinListenerFormattedField0Pg1::disposing( const ::com::sun::star::lang::EventObject& /* Source */ )
|
|
|
|
throw ( com::sun::star::uno::RuntimeException )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
// -----------------------------------------------------------------------------
|
|
|
|
|
2007-05-11 13:01:25 +00:00
|
|
|
void HelpCloseListener::addCloseListener( const Reference < XCloseListener >& ) throw( RuntimeException )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void HelpCloseListener::removeCloseListener( const Reference < XCloseListener >& ) throw( RuntimeException )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void HelpCloseListener::queryClosing( const EventObject&, sal_Bool /* bDeliverOwnership */ )
|
|
|
|
throw ( RuntimeException, CloseVetoException )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void HelpCloseListener::notifyClosing( const EventObject& )
|
|
|
|
throw ( RuntimeException )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
void HelpCloseListener::disposing( const EventObject& ) throw ( RuntimeException )
|
|
|
|
{
|
|
|
|
mrXFrame = NULL;
|
|
|
|
}
|
2010-10-12 15:55:21 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|