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
This commit is contained in:
Vladimir Glazounov
2005-02-21 11:05:35 +00:00
parent 9aac308503
commit 00f5e7bbce

View File

@@ -2,9 +2,9 @@
* *
* $RCSfile: olevisual.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@@ -58,7 +58,6 @@
* *
* *
************************************************************************/ ************************************************************************/
#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_ #ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
#include <com/sun/star/lang/DisposedException.hpp> #include <com/sun/star/lang/DisposedException.hpp>
#endif #endif
@@ -149,7 +148,7 @@ void SAL_CALL OleEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const awt
} }
catch( uno::Exception& ) 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_aCachedSize = m_pOleComponent->GetExtent( nAspect ); // will throw an exception in case of failure
m_nCachedAspect = nAspect; m_nCachedAspect = nAspect;
m_bHasCachedSize = sal_True; m_bHasCachedSize = sal_True;
return m_aCachedSize;
} }
catch( lang::IllegalArgumentException& ) 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 to switch the object to RUNNONG state and request the value again
try { try {
changeState( embed::EmbedStates::RUNNING ); changeState( embed::EmbedStates::RUNNING );
m_aCachedSize = m_pOleComponent->GetExtent( nAspect ); // will throw an exception in case of failure
} }
catch( uno::Exception& ) 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" ); // TODO/LATER: this workaround must be implemented in the application
throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Illegal call!\n" ), OSL_ENSURE( sal_False, "The workaround must be implemented in application, not in embedded object!\n" );
uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); 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_nCachedAspect = nAspect;
m_bHasCachedSize = sal_True; m_bHasCachedSize = sal_True;
return m_aCachedSize;
} }
else else
{ {
OSL_ENSURE( nAspect == m_nCachedAspect, "Unexpected aspect is requested!\n" ); 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 else
#endif #endif
@@ -238,15 +245,20 @@ awt::Size SAL_CALL OleEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
if ( m_bHasCachedSize ) if ( m_bHasCachedSize )
{ {
OSL_ENSURE( nAspect == m_nCachedAspect, "Unexpected aspect is requested!\n" ); OSL_ENSURE( nAspect == m_nCachedAspect, "Unexpected aspect is requested!\n" );
return m_aCachedSize;
} }
else 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" ); // TODO/LATER: this workaround must be implemented in the application
throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Illegal call!\n" ), OSL_ENSURE( sal_False, "The workaround must be implemented in application, not in embedded object!\n" );
uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) ); 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 ) embed::VisualRepresentation SAL_CALL OleEmbeddedObject::getPreferredVisualRepresentation( sal_Int64 nAspect )