added spinfield for jpeg quality control to allow steps of 10

This commit is contained in:
Sven Jacobi 2007-08-16 13:33:00 +00:00
parent dc40a8e4a7
commit 4dc2d365bc
3 changed files with 88 additions and 8 deletions

View file

@ -4,9 +4,9 @@
*
* $RCSfile: optimizerdialog.cxx,v $
*
* $Revision: 1.4 $
* $Revision: 1.5 $
*
* last change: $Author: sj $ $Date: 2007-08-15 16:38:45 $
* last change: $Author: sj $ $Date: 2007-08-16 14:33:00 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@ -308,6 +308,7 @@ OptimizerDialog::OptimizerDialog( const Reference< XComponentContext > &rxMSF, R
mxActionListenerListBox0Pg0( new ActionListenerListBox0Pg0( *this ) ),
mxTextListenerFormattedField0Pg1( new TextListenerFormattedField0Pg1( *this ) ),
mxTextListenerComboBox0Pg1( new TextListenerComboBox0Pg1( *this ) ),
mxSpinListenerFormattedField0Pg1( new SpinListenerFormattedField0Pg1( *this ) ),
mxStatusDispatcher( rxStatusDispatcher )
{
Reference< XStorable > xStorable( mxController->getModel(), UNO_QUERY_THROW );
@ -847,6 +848,56 @@ void TextListenerComboBox0Pg1::disposing( const ::com::sun::star::lang::EventObj
throw ( com::sun::star::uno::RuntimeException )
{
}
// -----------------------------------------------------------------------------
void SpinListenerFormattedField0Pg1::up( const SpinEvent& /* rEvent */ )
throw ( com::sun::star::uno::RuntimeException )
{
double fDouble;
Any aAny = mrOptimizerDialog.getControlProperty( TKGet( TK_FormattedField0Pg1 ), TKGet( TK_EffectiveValue ) );
if ( aAny >>= fDouble )
{
fDouble += 9;
if ( fDouble > 100 )
fDouble = 100;
mrOptimizerDialog.setControlProperty( TKGet( TK_FormattedField0Pg1 ), TKGet( TK_EffectiveValue ), Any( fDouble ) );
mrOptimizerDialog.SetConfigProperty( TK_JPEGQuality, Any( (sal_Int32)fDouble ) );
}
}
void SpinListenerFormattedField0Pg1::down( const SpinEvent& /* rEvent */ )
throw ( com::sun::star::uno::RuntimeException )
{
double fDouble;
Any aAny = mrOptimizerDialog.getControlProperty( TKGet( TK_FormattedField0Pg1 ), TKGet( TK_EffectiveValue ) );
if ( aAny >>= fDouble )
{
fDouble -= 9;
if ( fDouble < 0 )
fDouble = 0;
mrOptimizerDialog.setControlProperty( TKGet( TK_FormattedField0Pg1 ), TKGet( TK_EffectiveValue ), Any( fDouble ) );
mrOptimizerDialog.SetConfigProperty( TK_JPEGQuality, Any( (sal_Int32)fDouble ) );
}
}
void SpinListenerFormattedField0Pg1::first( const SpinEvent& /* rEvent */ )
throw ( com::sun::star::uno::RuntimeException )
{
mrOptimizerDialog.setControlProperty( TKGet( TK_FormattedField0Pg1 ), TKGet( TK_EffectiveValue ), Any( static_cast< double >( 0 ) ) );
mrOptimizerDialog.SetConfigProperty( TK_JPEGQuality, Any( (sal_Int32)0 ) );
}
void SpinListenerFormattedField0Pg1::last( const SpinEvent& /* rEvent */ )
throw ( com::sun::star::uno::RuntimeException )
{
mrOptimizerDialog.setControlProperty( TKGet( TK_FormattedField0Pg1 ), TKGet( TK_EffectiveValue ), Any( static_cast< double >( 100 ) ) );
mrOptimizerDialog.SetConfigProperty( TK_JPEGQuality, Any( (sal_Int32)100 ) );
}
void SpinListenerFormattedField0Pg1::disposing( const ::com::sun::star::lang::EventObject& /* Source */ )
throw ( com::sun::star::uno::RuntimeException )
{
}
// -----------------------------------------------------------------------------
void HelpCloseListener::addCloseListener( const Reference < XCloseListener >& ) throw( RuntimeException )
{
}

View file

@ -4,9 +4,9 @@
*
* $RCSfile: optimizerdialog.hxx,v $
*
* $Revision: 1.2 $
* $Revision: 1.3 $
*
* last change: $Author: sj $ $Date: 2007-05-24 10:08:36 $
* last change: $Author: sj $ $Date: 2007-08-16 14:33:00 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@ -57,6 +57,12 @@
#ifndef _COM_SUN_STAR_AWT_XITEMLISTENER_HPP_
#include <com/sun/star/awt/XItemListener.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XSPINFIELD_HPP_
#include <com/sun/star/awt/XSpinField.hpp>
#endif
#ifndef _COM_SUN_STAR_AWT_XSPINLISTENER_HPP_
#include <com/sun/star/awt/XSpinListener.hpp>
#endif
#ifndef _COM_SUN_STAR_BEANS_XPROPERTYSET_HPP_
#include <com/sun/star/beans/XPropertySet.hpp>
#endif
@ -140,6 +146,7 @@ private :
com::sun::star::uno::Reference< com::sun::star::awt::XActionListener > mxActionListenerListBox0Pg0;
com::sun::star::uno::Reference< com::sun::star::awt::XTextListener > mxTextListenerFormattedField0Pg1;
com::sun::star::uno::Reference< com::sun::star::awt::XTextListener > mxTextListenerComboBox0Pg1;
com::sun::star::uno::Reference< com::sun::star::awt::XSpinListener > mxSpinListenerFormattedField0Pg1;
com::sun::star::uno::Reference< com::sun::star::frame::XDispatch > mxStatusDispatcher;
std::vector< std::vector< rtl::OUString > > maControlPages;
@ -255,6 +262,23 @@ private:
// -----------------------------------------------------------------------------
class SpinListenerFormattedField0Pg1 : public ::cppu::WeakImplHelper1< com::sun::star::awt::XSpinListener >
{
public:
SpinListenerFormattedField0Pg1( OptimizerDialog& rOptimizerDialog ) : mrOptimizerDialog( rOptimizerDialog ){};
virtual void SAL_CALL up( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
virtual void SAL_CALL down( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
virtual void SAL_CALL first( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
virtual void SAL_CALL last( const ::com::sun::star::awt::SpinEvent& Event ) throw ( com::sun::star::uno::RuntimeException );
virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw ( com::sun::star::uno::RuntimeException);
private:
OptimizerDialog& mrOptimizerDialog;
};
// -----------------------------------------------------------------------------
class HelpCloseListener : public ::cppu::WeakImplHelper1< com::sun::star::util::XCloseListener >
{
public:

View file

@ -4,9 +4,9 @@
*
* $RCSfile: optimizerdialogcontrols.cxx,v $
*
* $Revision: 1.7 $
* $Revision: 1.8 $
*
* last change: $Author: sj $ $Date: 2007-08-15 16:38:45 $
* last change: $Author: sj $ $Date: 2007-08-16 14:33:00 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@ -234,7 +234,7 @@ rtl::OUString InsertCheckBox( OptimizerDialog& rOptimizerDialog, const OUString&
// -----------------------------------------------------------------------------
rtl::OUString InsertFormattedField( OptimizerDialog& rOptimizerDialog, const OUString& rControlName,
const Reference< XTextListener > xTextListener, sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth,
const Reference< XTextListener > xTextListener, const Reference< XSpinListener > xSpinListener, sal_Int32 nXPos, sal_Int32 nYPos, sal_Int32 nWidth,
double fEffectiveMin, double fEffectiveMax, sal_Int16 nTabIndex )
{
OUString pNames[] = {
@ -271,6 +271,11 @@ rtl::OUString InsertFormattedField( OptimizerDialog& rOptimizerDialog, const OUS
Reference< XTextComponent > xTextComponent( rOptimizerDialog.insertFormattedField( rControlName, aNames, aValues ), UNO_QUERY_THROW );
if ( xTextListener.is() )
xTextComponent->addTextListener( xTextListener );
if ( xSpinListener.is() )
{
Reference< XSpinField > xSpinField( xTextComponent, UNO_QUERY_THROW );
xSpinField->addSpinListener( xSpinListener );
}
return rControlName;
}
@ -559,7 +564,7 @@ void OptimizerDialog::InitPage2()
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++ ) );
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++ ) );
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++ ) );
aControlList.push_back( InsertFormattedField( *this, TKGet( TK_FormattedField0Pg1 ), mxTextListenerFormattedField0Pg1, PAGE_POS_X + 106, PAGE_POS_Y + 38, 50, 0, 100, mnTabIndex++ ) );
aControlList.push_back( InsertFormattedField( *this, TKGet( TK_FormattedField0Pg1 ), mxTextListenerFormattedField0Pg1, mxSpinListenerFormattedField0Pg1, PAGE_POS_X + 106, PAGE_POS_Y + 38, 50, 0, 100, mnTabIndex++ ) );
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++ ) );
aControlList.push_back( InsertComboBox( *this, TKGet( TK_ComboBox0Pg1 ), mxTextListenerComboBox0Pg1, sal_True, aResolutionItemList, PAGE_POS_X + 106, PAGE_POS_Y + 52, 100, 12, mnTabIndex++ ) );
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++ ) );