diff options
Diffstat (limited to 'vbahelper/source/msforms')
-rw-r--r-- | vbahelper/source/msforms/makefile.mk | 9 | ||||
-rw-r--r-- | vbahelper/source/msforms/vbacontrol.cxx | 1 | ||||
-rw-r--r-- | vbahelper/source/msforms/vbauserform.cxx | 36 |
3 files changed, 30 insertions, 16 deletions
diff --git a/vbahelper/source/msforms/makefile.mk b/vbahelper/source/msforms/makefile.mk index 5fce64649d..40a6b8350f 100644 --- a/vbahelper/source/msforms/makefile.mk +++ b/vbahelper/source/msforms/makefile.mk @@ -70,12 +70,3 @@ SLOFILES=\ .INCLUDE : target.mk -ALLTAR : \ - $(MISC)$/$(TARGET).don \ - -$(SLOFILES) : $(MISC)$/$(TARGET).don - -$(MISC)$/$(TARGET).don : $(SOLARBINDIR)$/oovbaapi.rdb - +$(CPPUMAKER) -O$(INCCOM)$/$(TARGET) -BUCR $(SOLARBINDIR)$/oovbaapi.rdb -X$(SOLARBINDIR)$/types.rdb && echo > $@ - echo $@ - diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx index 7485073321..28f6d7f61c 100644 --- a/vbahelper/source/msforms/vbacontrol.cxx +++ b/vbahelper/source/msforms/vbacontrol.cxx @@ -227,7 +227,6 @@ void SAL_CALL ScVbaControl::setLeft( double _left ) throw (uno::RuntimeException) { mpGeometryHelper->setLeft( _left ); - } double SAL_CALL diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx index 33e357b00c..3db05ee747 100644 --- a/vbahelper/source/msforms/vbauserform.cxx +++ b/vbahelper/source/msforms/vbauserform.cxx @@ -28,7 +28,9 @@ #include "vbauserform.hxx" #include <com/sun/star/awt/XControl.hpp> #include <com/sun/star/awt/XControlContainer.hpp> +#include <com/sun/star/awt/PosSize.hpp> #include <com/sun/star/beans/PropertyConcept.hpp> +#include <com/sun/star/util/MeasureUnit.hpp> #include <basic/sbx.hxx> #include <basic/sbstar.hxx> #include <basic/sbmeth.hxx> @@ -64,9 +66,28 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException) { OSL_TRACE("ScVbaUserForm::Show( )"); short aRet = 0; - mbDispose = true; + mbDispose = true; + if ( m_xDialog.is() ) + { + // try to center dialog on model window + if( m_xModel.is() ) try + { + uno::Reference< frame::XController > xController( m_xModel->getCurrentController(), uno::UNO_SET_THROW ); + uno::Reference< frame::XFrame > xFrame( xController->getFrame(), uno::UNO_SET_THROW ); + uno::Reference< awt::XWindow > xWindow( xFrame->getContainerWindow(), uno::UNO_SET_THROW ); + awt::Rectangle aPosSize = xWindow->getPosSize(); // already in pixel + + uno::Reference< awt::XControl > xControl( m_xDialog, uno::UNO_QUERY_THROW ); + uno::Reference< awt::XWindow > xControlWindow( xControl->getPeer(), uno::UNO_QUERY_THROW ); + xControlWindow->setPosSize( (aPosSize.Width - getWidth()) / 2.0, (aPosSize.Height - getHeight()) / 2.0, 0, 0, awt::PosSize::POS ); + } + catch( uno::Exception& ) + { + } + aRet = m_xDialog->execute(); + } OSL_TRACE("ScVbaUserForm::Show() execute returned %d", aRet); if ( mbDispose ) { @@ -180,11 +201,14 @@ ScVbaUserForm::getValue( const ::rtl::OUString& aPropertyName ) throw (beans::Un uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY_THROW ); uno::Reference< awt::XControlContainer > xContainer( m_xDialog, uno::UNO_QUERY_THROW ); uno::Reference< awt::XControl > xControl = xContainer->getControl( aPropertyName ); - ScVbaControlFactory aFac( mxContext, xControl, m_xModel ); - uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) ); - ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() ); - pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) ); - aResult = uno::makeAny( xVBAControl ); + if ( xControl.is() ) + { + ScVbaControlFactory aFac( mxContext, xControl, m_xModel ); + uno::Reference< msforms::XControl > xVBAControl( aFac.createControl( xDialogControl->getModel() ) ); + ScVbaControl* pControl = dynamic_cast< ScVbaControl* >( xVBAControl.get() ); + pControl->setGeometryHelper( new UserFormGeometryHelper( mxContext, xControl ) ); + aResult = uno::makeAny( xVBAControl ); + } } return aResult; |