diff options
author | Noel Grandin <noel@peralex.com> | 2013-05-16 14:13:36 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-05-21 08:23:58 +0200 |
commit | 6c61b20a8d4a6dcac28801cde82a211fb7e30654 (patch) | |
tree | d82328eaa120b8bc822f028fa1e62bc7814c9e1b /sdext | |
parent | 6c53dff36ebdac7b6a6cf514ab469b2202d6aa48 (diff) |
fdo#46808, Convert awt::UnoControlDialogModel to new style
Change-Id: I4b912034ef3f4855b87d6d6f18ff13bd1ecc8f72
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/source/minimizer/informationdialog.cxx | 31 | ||||
-rw-r--r-- | sdext/source/minimizer/optimizerdialog.cxx | 33 | ||||
-rw-r--r-- | sdext/source/minimizer/unodialog.cxx | 46 | ||||
-rw-r--r-- | sdext/source/minimizer/unodialog.hxx | 12 |
4 files changed, 38 insertions, 84 deletions
diff --git a/sdext/source/minimizer/informationdialog.cxx b/sdext/source/minimizer/informationdialog.cxx index babba10cfaf1..5c51ae28392b 100644 --- a/sdext/source/minimizer/informationdialog.cxx +++ b/sdext/source/minimizer/informationdialog.cxx @@ -216,30 +216,13 @@ void InformationDialog::InitDialog() nDialogHeight -= 22; // setting the dialog properties - OUString pNames[] = { - TKGet( TK_Closeable ), - TKGet( TK_Height ), - TKGet( TK_Moveable ), - TKGet( TK_PositionX ), - TKGet( TK_PositionY ), - TKGet( TK_Title ), - TKGet( TK_Width ) }; - - Any pValues[] = { - Any( sal_True ), - Any( nDialogHeight ), - Any( sal_True ), - Any( sal_Int32( 245 ) ), - Any( sal_Int32( 115 ) ), - Any( getString( STR_SUN_OPTIMIZATION_WIZARD2 ) ), - Any( sal_Int32( DIALOG_WIDTH ) ) }; - - sal_Int32 nCount = SAL_N_ELEMENTS( pNames ); - - Sequence< OUString > aNames( pNames, nCount ); - Sequence< Any > aValues( pValues, nCount ); - - mxDialogModelMultiPropertySet->setPropertyValues( aNames, aValues ); + mxDialogModel->setCloseable(sal_True); + mxDialogModel->setHeight(nDialogHeight); + mxDialogModel->setMoveable(sal_True); + mxDialogModel->setPositionX(245); + mxDialogModel->setPositionY(115); + mxDialogModel->setTitle(getString( STR_SUN_OPTIMIZATION_WIZARD2 )); + mxDialogModel->setWidth(sal_Int32( DIALOG_WIDTH ) ); sal_Int64 nSource = mnSourceSize; sal_Int64 nDest = mnDestSize; diff --git a/sdext/source/minimizer/optimizerdialog.cxx b/sdext/source/minimizer/optimizerdialog.cxx index d6c73488725d..e8ef92b40248 100644 --- a/sdext/source/minimizer/optimizerdialog.cxx +++ b/sdext/source/minimizer/optimizerdialog.cxx @@ -52,30 +52,13 @@ using namespace ::com::sun::star::container; void OptimizerDialog::InitDialog() { // setting the dialog properties - OUString pNames[] = { - TKGet( TK_Closeable ), - TKGet( TK_Height ), - TKGet( TK_Moveable ), - TKGet( TK_PositionX ), - TKGet( TK_PositionY ), - TKGet( TK_Title ), - TKGet( TK_Width ) }; - - 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 ); + mxDialogModel->setCloseable(sal_True); + mxDialogModel->setHeight(sal_Int32( DIALOG_HEIGHT )); + mxDialogModel->setMoveable(sal_True); + mxDialogModel->setPositionX(200); + mxDialogModel->setPositionY(52); + mxDialogModel->setTitle(getString( STR_SUN_OPTIMIZATION_WIZARD2 )); + mxDialogModel->setWidth(sal_Int32( OD_DIALOG_WIDTH ) ); } // ----------------------------------------------------------------------------- @@ -522,7 +505,7 @@ void ActionListener::actionPerformed( const ActionEvent& rEvent ) if ( nInt16 ) { OUString aSaveAsURL; - FileOpenDialog aFileOpenDialog( ((UnoDialog&)mrOptimizerDialog).mxMSF ); + FileOpenDialog aFileOpenDialog( ((UnoDialog&)mrOptimizerDialog).mxContext ); // generating default file name Reference< XStorable > xStorable( mrOptimizerDialog.mxController->getModel(), UNO_QUERY ); diff --git a/sdext/source/minimizer/unodialog.cxx b/sdext/source/minimizer/unodialog.cxx index 922527e2a88d..29291b73f022 100644 --- a/sdext/source/minimizer/unodialog.cxx +++ b/sdext/source/minimizer/unodialog.cxx @@ -19,15 +19,16 @@ #include "unodialog.hxx" -#include <com/sun/star/text/XTextRange.hpp> -#include <com/sun/star/drawing/XShapes.hpp> -#include <com/sun/star/container/XIndexAccess.hpp> -#include <com/sun/star/view/XSelectionSupplier.hpp> -#include <com/sun/star/view/XControlAccess.hpp> -#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/awt/UnoControlDialogModel.hpp> #include <com/sun/star/awt/Toolkit.hpp> #include <com/sun/star/awt/XMessageBoxFactory.hpp> #include <com/sun/star/awt/MessageBoxButtons.hpp> +#include <com/sun/star/container/XIndexAccess.hpp> +#include <com/sun/star/drawing/XShapes.hpp> +#include <com/sun/star/frame/XDispatch.hpp> +#include <com/sun/star/text/XTextRange.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/view/XControlAccess.hpp> // ------------- // - UnoDialog - @@ -43,23 +44,16 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::script; -UnoDialog::UnoDialog( const Reference< XComponentContext > &rxMSF, Reference< XFrame >& rxFrame ) : - mxMSF( rxMSF ), +UnoDialog::UnoDialog( const Reference< XComponentContext > &rxContext, Reference< XFrame >& rxFrame ) : + mxContext( rxContext ), mxController( rxFrame->getController() ), - mxDialogModel( mxMSF->getServiceManager()->createInstanceWithContext( OUString( - "com.sun.star.awt.UnoControlDialogModel" ), mxMSF ), UNO_QUERY_THROW ), - mxDialogModelMultiPropertySet( mxDialogModel, UNO_QUERY_THROW ), - mxDialogModelPropertySet( mxDialogModel, UNO_QUERY_THROW ), - mxDialogModelMSF( mxDialogModel, UNO_QUERY_THROW ), - mxDialogModelNameContainer( mxDialogModel, UNO_QUERY_THROW ), - mxDialogModelNameAccess( mxDialogModel, UNO_QUERY_THROW ), - mxControlModel( mxDialogModel, UNO_QUERY_THROW ), - mxDialog( mxMSF->getServiceManager()->createInstanceWithContext( OUString( - "com.sun.star.awt.UnoControlDialog" ), mxMSF ), UNO_QUERY_THROW ), + mxDialogModel( UnoControlDialogModel::create(rxContext) ), + mxDialog( mxContext->getServiceManager()->createInstanceWithContext( OUString( + "com.sun.star.awt.UnoControlDialog" ), mxContext ), UNO_QUERY_THROW ), mxControl( mxDialog, UNO_QUERY_THROW ), mbStatus( sal_False ) { - mxControl->setModel( mxControlModel ); + mxControl->setModel( mxDialogModel ); mxDialogControlContainer = Reference< XControlContainer >( mxDialog, UNO_QUERY_THROW ); mxDialogComponent = Reference< XComponent >( mxDialog, UNO_QUERY_THROW ); mxDialogWindow = Reference< XWindow >( mxDialog, UNO_QUERY_THROW ); @@ -98,7 +92,7 @@ Reference< XWindowPeer > UnoDialog::createWindowPeer( Reference< XWindowPeer > x throw ( Exception ) { mxDialogWindow->setVisible( sal_False ); - Reference< XToolkit > xToolkit( Toolkit::create( mxMSF ), UNO_QUERY_THROW ); + Reference< XToolkit > xToolkit( Toolkit::create( mxContext ), UNO_QUERY_THROW ); if ( !xParentPeer.is() ) xParentPeer = xToolkit->getDesktopWindow(); mxReschedule = Reference< XReschedule >( xToolkit, UNO_QUERY ); @@ -115,10 +109,10 @@ Reference< XInterface > UnoDialog::insertControlModel( const OUString& rServiceN Reference< XInterface > xControlModel; try { - xControlModel = mxDialogModelMSF->createInstance( rServiceName ); + xControlModel = mxDialogModel->createInstance( rServiceName ); Reference< XMultiPropertySet > xMultiPropSet( xControlModel, UNO_QUERY_THROW ); xMultiPropSet->setPropertyValues( rPropertyNames, rPropertyValues ); - mxDialogModelNameContainer->insertByName( rName, Any( xControlModel ) ); + mxDialogModel->insertByName( rName, Any( xControlModel ) ); } catch( Exception& ) { @@ -300,9 +294,9 @@ void UnoDialog::setControlProperty( const OUString& rControlName, const OUString { try { - if ( mxDialogModelNameAccess->hasByName( rControlName ) ) + if ( mxDialogModel->hasByName( rControlName ) ) { - Reference< XPropertySet > xPropertySet( mxDialogModelNameAccess->getByName( rControlName ), UNO_QUERY_THROW ); + Reference< XPropertySet > xPropertySet( mxDialogModel->getByName( rControlName ), UNO_QUERY_THROW ); xPropertySet->setPropertyValue( rPropertyName, rPropertyValue ); } } @@ -318,9 +312,9 @@ Any UnoDialog::getControlProperty( const OUString& rControlName, const OUString& Any aRet; try { - if ( mxDialogModelNameAccess->hasByName( rControlName ) ) + if ( mxDialogModel->hasByName( rControlName ) ) { - Reference< XPropertySet > xPropertySet( mxDialogModelNameAccess->getByName( rControlName ), UNO_QUERY_THROW ); + Reference< XPropertySet > xPropertySet( mxDialogModel->getByName( rControlName ), UNO_QUERY_THROW ); aRet = xPropertySet->getPropertyValue( rPropertyName ); } } diff --git a/sdext/source/minimizer/unodialog.hxx b/sdext/source/minimizer/unodialog.hxx index b08ce1e5d8fe..37be5e01149b 100644 --- a/sdext/source/minimizer/unodialog.hxx +++ b/sdext/source/minimizer/unodialog.hxx @@ -39,6 +39,7 @@ #include <com/sun/star/awt/XButton.hpp> #include <com/sun/star/awt/XCheckBox.hpp> #include <com/sun/star/awt/XComboBox.hpp> +#include <com/sun/star/awt/XUnoControlDialogModel.hpp> #include <com/sun/star/awt/XTextComponent.hpp> #include <com/sun/star/awt/XRadioButton.hpp> #include <com/sun/star/awt/XListBox.hpp> @@ -106,18 +107,11 @@ public : void enableControl( const OUString& rControlName ); void disableControl( const OUString& rControlName ); - com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxMSF; + com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext; com::sun::star::uno::Reference< com::sun::star::frame::XController > mxController; com::sun::star::uno::Reference< com::sun::star::awt::XReschedule > mxReschedule; - com::sun::star::uno::Reference< com::sun::star::uno::XInterface > mxDialogModel; - com::sun::star::uno::Reference< com::sun::star::beans::XMultiPropertySet > mxDialogModelMultiPropertySet; - com::sun::star::uno::Reference< com::sun::star::beans::XPropertySet > mxDialogModelPropertySet; - com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxDialogModelMSF; - com::sun::star::uno::Reference< com::sun::star::container::XNameContainer > mxDialogModelNameContainer; - com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > mxDialogModelNameAccess; - - com::sun::star::uno::Reference< com::sun::star::awt::XControlModel > mxControlModel; + com::sun::star::uno::Reference< com::sun::star::awt::XUnoControlDialogModel > mxDialogModel; com::sun::star::uno::Reference< com::sun::star::awt::XDialog > mxDialog; com::sun::star::uno::Reference< com::sun::star::awt::XControl > mxControl; |