From 20755856d6007b9f4316c6ba2a571b26d0de85da Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Mon, 28 Feb 2011 10:00:23 +0100 Subject: fwk167: #i70217 No need to assert if the same instance is set. Don't create a fresh VCLXDialog instance if has been created in the window ctor --- toolkit/source/awt/vclxtoolkit.cxx | 9 ++++++++- toolkit/source/helper/unowrapper.cxx | 10 ++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'toolkit') diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx index dd6e28807bc6..1c2df22e56a7 100644 --- a/toolkit/source/awt/vclxtoolkit.cxx +++ b/toolkit/source/awt/vclxtoolkit.cxx @@ -786,7 +786,14 @@ Window* VCLXToolkit::ImplCreateWindow( VCLXWindow** ppNewComp, if ( (pParent == NULL ) && ( rDescriptor.ParentIndex == -1 ) ) pParent = DIALOG_NO_PARENT; pNewWindow = new Dialog( pParent, nWinBits ); - *ppNewComp = new VCLXDialog; + // #i70217# Don't always create a new component object. It's possible that VCL has called + // GetComponentInterface( sal_True ) in the Dialog ctor itself (see Window::IsTopWindow() ) + // which creates a component object. + css::uno::Reference< css::awt::XWindowPeer > xWinPeer = pNewWindow->GetComponentInterface( sal_False ); + if ( xWinPeer.is() ) + *ppNewComp = dynamic_cast< VCLXDialog* >( xWinPeer.get() ); + else + *ppNewComp = new VCLXDialog; } break; case WINDOW_MOREBUTTON: diff --git a/toolkit/source/helper/unowrapper.cxx b/toolkit/source/helper/unowrapper.cxx index 1b676ec0edb3..7046f9485d36 100644 --- a/toolkit/source/helper/unowrapper.cxx +++ b/toolkit/source/helper/unowrapper.cxx @@ -180,11 +180,13 @@ void UnoWrapper::SetWindowInterface( Window* pWindow, ::com::sun::star::uno::Ref DBG_ASSERT( pVCLXWindow, "SetComponentInterface - unsupported type" ); if ( pVCLXWindow ) { - if( pWindow->GetWindowPeer() ) + ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer> xPeer = pWindow->GetWindowPeer(); + if( xPeer.is() ) { - int i = 0; - i++; - // DBG_ERROR( "UnoWrapper::SetWindowInterface: there already *is* a WindowInterface for this window!" ); + bool bSameInstance( pVCLXWindow == dynamic_cast< VCLXWindow* >( xPeer.get() )); + DBG_ASSERT( bSameInstance, "UnoWrapper::SetWindowInterface: there already *is* a WindowInterface for this window!" ); + if ( bSameInstance ) + return; } pVCLXWindow->SetWindow( pWindow ); pWindow->SetWindowPeer( xIFace, pVCLXWindow ); -- cgit From c2e4254b329463732e203e8e7f3cd57c592990e8 Mon Sep 17 00:00:00 2001 From: Carsten Driesner Date: Wed, 9 Mar 2011 10:03:44 +0100 Subject: fwk167: #i87596# Remove decoration on windowResized() only in design mode. VCL works without decoration and so does the toolkit. In design mode the drawing layer wants to include the decoration. So using mbDesignMode helps to complete the fix --- toolkit/source/controls/dialogcontrol.cxx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'toolkit') diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index 15eeb2aa1939..e507267c1aed 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -354,7 +354,10 @@ throw (::com::sun::star::uno::RuntimeException) Reference< XControl > xDialogControl( *this, UNO_QUERY_THROW ); Reference< XDevice > xDialogDevice( xDialogControl->getPeer(), UNO_QUERY ); OSL_ENSURE( xDialogDevice.is(), "UnoDialogControl::windowResized: no peer, but a windowResized event?" ); - if ( xDialogDevice.is() ) + + // #i87592 In design mode the drawing layer works with sizes with decoration. + // Therefore we have to substract them before writing back to the properties (model). + if ( xDialogDevice.is() && mbDesignMode ) { DeviceInfo aDeviceInfo( xDialogDevice->getInfo() ); aAppFontSize.Width() -= aDeviceInfo.LeftInset + aDeviceInfo.RightInset; -- cgit