mib19: #i163287# workaround setPosSize() problem of toolkit

This commit is contained in:
Mikhail Voytenko 2010-08-30 16:48:36 +02:00
parent 74c37f3287
commit c30f688a87
2 changed files with 7 additions and 4 deletions

View file

@ -227,7 +227,6 @@ void SAL_CALL
ScVbaControl::setLeft( double _left ) throw (uno::RuntimeException)
{
mpGeometryHelper->setLeft( _left );
}
double SAL_CALL

View file

@ -28,6 +28,7 @@
#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>
@ -69,7 +70,6 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException)
if ( m_xDialog.is() )
{
aRet = m_xDialog->execute();
// try to center dialog on model window
if( m_xModel.is() ) try
{
@ -77,12 +77,16 @@ ScVbaUserForm::Show( ) throw (uno::RuntimeException)
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
setLeft( (aPosSize.Width - getWidth()) / 2.0 );
setTop( (aPosSize.Height - getHeight()) / 2.0 );
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 )