From 00f5e7bbcecda6748e2f9e35c1ea47f08c94b768 Mon Sep 17 00:00:00 2001 From: Vladimir Glazounov Date: Mon, 21 Feb 2005 11:05:35 +0000 Subject: [PATCH] INTEGRATION: CWS msolesize1 (1.5.4); FILE MERGED 2005/02/10 08:48:55 mav 1.5.4.3: #i42331# fix msole size retrieving problem 2005/02/10 07:50:06 mav 1.5.4.2: #i42331# fix msole size retrieving problem 2005/02/10 07:35:18 mav 1.5.4.1: #i42331# fix msole size retrieving problem --- embeddedobj/source/msole/olevisual.cxx | 42 +++++++++++++++++--------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/embeddedobj/source/msole/olevisual.cxx b/embeddedobj/source/msole/olevisual.cxx index 1faa41f35a33..f4efca72f613 100644 --- a/embeddedobj/source/msole/olevisual.cxx +++ b/embeddedobj/source/msole/olevisual.cxx @@ -2,9 +2,9 @@ * * $RCSfile: olevisual.cxx,v $ * - * $Revision: 1.5 $ + * $Revision: 1.6 $ * - * last change: $Author: rt $ $Date: 2005-01-31 09:03:24 $ + * last change: $Author: vg $ $Date: 2005-02-21 12:05:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -58,7 +58,6 @@ * * ************************************************************************/ - #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #include #endif @@ -149,7 +148,7 @@ void SAL_CALL OleEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const awt } catch( uno::Exception& ) { - OSL_ASSERT( "The object should not be resized without activation!\n" ); + OSL_ENSURE( sal_False, "The object should not be resized without activation!\n" ); } } @@ -198,7 +197,6 @@ awt::Size SAL_CALL OleEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect ) m_aCachedSize = m_pOleComponent->GetExtent( nAspect ); // will throw an exception in case of failure m_nCachedAspect = nAspect; m_bHasCachedSize = sal_True; - return m_aCachedSize; } catch( lang::IllegalArgumentException& ) { @@ -211,25 +209,34 @@ awt::Size SAL_CALL OleEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect ) // try to switch the object to RUNNONG state and request the value again try { changeState( embed::EmbedStates::RUNNING ); + m_aCachedSize = m_pOleComponent->GetExtent( nAspect ); // will throw an exception in case of failure } catch( uno::Exception& ) { - OSL_ASSERT( "The size of the OLE object that can't be activated is requested!\nNo size was provided to the object for caching!\n" ); - throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Illegal call!\n" ), - uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); + // TODO/LATER: this workaround must be implemented in the application + OSL_ENSURE( sal_False, "The workaround must be implemented in application, not in embedded object!\n" ); + return awt::Size( 5000, 5000 ); + + //OSL_ENSURE( sal_False, "The size of the OLE object that can't be activated is requested!\nNo size was provided to the object for caching!\n" ); + //throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Illegal call!\n" ), + // uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); + } - m_aCachedSize = m_pOleComponent->GetExtent( nAspect ); // will throw an exception in case of failure m_nCachedAspect = nAspect; m_bHasCachedSize = sal_True; - return m_aCachedSize; } else { OSL_ENSURE( nAspect == m_nCachedAspect, "Unexpected aspect is requested!\n" ); - return m_aCachedSize; } } + catch ( uno::Exception& ) + { + // TODO/LATER: this workaround must be implemented in the application + OSL_ENSURE( sal_False, "The workaround must be implemented in application, not in embedded object!\n" ); + return awt::Size( 5000, 5000 ); + } } else #endif @@ -238,15 +245,20 @@ awt::Size SAL_CALL OleEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect ) if ( m_bHasCachedSize ) { OSL_ENSURE( nAspect == m_nCachedAspect, "Unexpected aspect is requested!\n" ); - return m_aCachedSize; } else { - OSL_ASSERT( "The size of the OLE object that can't be activated is requested!\nNo size was provided to the object for caching!\n" ); - throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Illegal call!\n" ), - uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); + // TODO/LATER: this workaround must be implemented in the application + OSL_ENSURE( sal_False, "The workaround must be implemented in application, not in embedded object!\n" ); + return awt::Size( 5000, 5000 ); + + // OSL_ENSURE( sal_False, "The size of the OLE object that can't be activated is requested!\nNo size was provided to the object for caching!\n" ); + // throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Illegal call!\n" ), + // uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); } } + + return m_aCachedSize; } embed::VisualRepresentation SAL_CALL OleEmbeddedObject::getPreferredVisualRepresentation( sal_Int64 nAspect )