summaryrefslogtreecommitdiff
path: root/forms/source/component
diff options
context:
space:
mode:
Diffstat (limited to 'forms/source/component')
-rw-r--r--forms/source/component/ComboBox.cxx2
-rw-r--r--forms/source/component/FormComponent.cxx6
-rw-r--r--forms/source/component/Grid.cxx2
-rw-r--r--forms/source/component/ImageControl.cxx6
-rw-r--r--forms/source/component/ListBox.cxx12
-rw-r--r--forms/source/component/imgprod.cxx94
-rw-r--r--forms/source/component/imgprod.hxx7
-rw-r--r--forms/source/component/refvaluecomponent.cxx2
8 files changed, 45 insertions, 86 deletions
diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx
index 4ddf4532f51b..f2c8cbfa2ccf 100644
--- a/forms/source/component/ComboBox.cxx
+++ b/forms/source/component/ComboBox.cxx
@@ -668,7 +668,7 @@ void OComboBoxModel::loadData( bool _bForce )
}
break;
default:
- OSL_ENSURE( false, "OComboBoxModel::loadData: unreachable!" );
+ OSL_FAIL( "OComboBoxModel::loadData: unreachable!" );
break;
}
}
diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx
index b3e9b55dc280..4eeb9970da33 100644
--- a/forms/source/component/FormComponent.cxx
+++ b/forms/source/component/FormComponent.cxx
@@ -992,7 +992,7 @@ Any OControlModel::getPropertyDefaultByHandle( sal_Int32 _nHandle ) const
if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) )
m_aPropertyBagHelper.getDynamicPropertyDefaultByHandle( _nHandle, aReturn );
else
- OSL_ENSURE( false, "OControlModel::convertFastPropertyValue: unknown handle!" );
+ OSL_FAIL( "OControlModel::convertFastPropertyValue: unknown handle!" );
}
return aReturn;
}
@@ -1050,7 +1050,7 @@ sal_Bool OControlModel::convertFastPropertyValue(
if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) )
bModified = m_aPropertyBagHelper.convertDynamicFastPropertyValue( _nHandle, _rValue, _rConvertedValue, _rOldValue );
else
- OSL_ENSURE( false, "OControlModel::convertFastPropertyValue: unknown handle!" );
+ OSL_FAIL( "OControlModel::convertFastPropertyValue: unknown handle!" );
break;
}
return bModified;
@@ -1084,7 +1084,7 @@ void OControlModel::setFastPropertyValue_NoBroadcast(sal_Int32 _nHandle, const A
if ( m_aPropertyBagHelper.hasDynamicPropertyByHandle( _nHandle ) )
m_aPropertyBagHelper.setDynamicFastPropertyValue( _nHandle, _rValue );
else
- OSL_ENSURE( false, "OControlModel::setFastPropertyValue_NoBroadcast: unknown handle!" );
+ OSL_FAIL( "OControlModel::setFastPropertyValue_NoBroadcast: unknown handle!" );
break;
}
}
diff --git a/forms/source/component/Grid.cxx b/forms/source/component/Grid.cxx
index 7fdb83591834..274e77fbd407 100644
--- a/forms/source/component/Grid.cxx
+++ b/forms/source/component/Grid.cxx
@@ -256,7 +256,7 @@ Reference< XRowSet > SAL_CALL OGridControlModel::getRowSet( ) throw (RuntimeExc
//------------------------------------------------------------------------------
void SAL_CALL OGridControlModel::setRowSet( const Reference< XRowSet >& /*_rxDataSource*/ ) throw (RuntimeException)
{
- OSL_ENSURE( false, "OGridControlModel::setRowSet: not supported!" );
+ OSL_FAIL( "OGridControlModel::setRowSet: not supported!" );
}
//--------------------------------------------------------------------
diff --git a/forms/source/component/ImageControl.cxx b/forms/source/component/ImageControl.cxx
index 7664a51519f3..c05e9e3f2828 100644
--- a/forms/source/component/ImageControl.cxx
+++ b/forms/source/component/ImageControl.cxx
@@ -488,7 +488,7 @@ sal_Bool OImageControlModel::impl_handleNewImageURL_lck( ValueChangeInstigator _
break;
case ImageStoreInvalid:
- OSL_ENSURE( false, "OImageControlModel::impl_handleNewImageURL_lck: image storage type type!" );
+ OSL_FAIL( "OImageControlModel::impl_handleNewImageURL_lck: image storage type type!" );
break;
}
@@ -588,7 +588,7 @@ Any OImageControlModel::translateDbColumnToControlValue()
return makeAny( sImageLink );
}
case ImageStoreInvalid:
- OSL_ENSURE( false, "OImageControlModel::translateDbColumnToControlValue: invalid field type!" );
+ OSL_FAIL( "OImageControlModel::translateDbColumnToControlValue: invalid field type!" );
break;
}
return Any();
@@ -630,7 +630,7 @@ void OImageControlModel::doSetControlValue( const Any& _rValue )
break;
case ImageStoreInvalid:
- OSL_ENSURE( false, "OImageControlModel::doSetControlValue: invalid field type!" );
+ OSL_FAIL( "OImageControlModel::doSetControlValue: invalid field type!" );
break;
} // switch ( lcl_getImageStoreType( getFieldType() ) )
diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx
index 749cc0afbad0..a489f50ffeda 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -341,7 +341,7 @@ namespace frm
break;
case PROPERTY_ID_VALUE_SEQ :
- OSL_ENSURE( false, "ValueItemList is read-only!" );
+ OSL_FAIL( "ValueItemList is read-only!" );
throw PropertyVetoException();
case PROPERTY_ID_DEFAULT_SELECT_SEQ :
@@ -392,7 +392,7 @@ namespace frm
break;
case PROPERTY_ID_VALUE_SEQ :
- OSL_ENSURE( false, "ValueItemList is read-only!" );
+ OSL_FAIL( "ValueItemList is read-only!" );
throw PropertyVetoException();
case PROPERTY_ID_DEFAULT_SELECT_SEQ :
@@ -900,7 +900,7 @@ namespace frm
}
break;
default:
- OSL_ENSURE( false, "OListBoxModel::loadData: unreachable!" );
+ OSL_FAIL( "OListBoxModel::loadData: unreachable!" );
break;
}
}
@@ -1002,7 +1002,7 @@ namespace frm
size_t selectedValue = aSelectedIndices[0];
if ( selectedValue >= aValues.size() )
{
- OSL_ENSURE( false, "OListBoxModel::getFirstSelectedValue: inconsistent selection/valuelist!" );
+ OSL_FAIL( "OListBoxModel::getFirstSelectedValue: inconsistent selection/valuelist!" );
return s_aEmptyVaue;
}
@@ -1041,7 +1041,7 @@ namespace frm
Reference< XPropertySet > xBoundField( getField() );
if ( !xBoundField.is() )
{
- OSL_ENSURE( false, "OListBoxModel::translateDbColumnToControlValue: no field? How could that happen?!" );
+ OSL_FAIL( "OListBoxModel::translateDbColumnToControlValue: no field? How could that happen?!" );
return Any();
}
@@ -1149,7 +1149,7 @@ namespace frm
default:
break;
}
- OSL_ENSURE( false, "lcl_getCurrentExchangeType: unsupported (unexpected) exchange type!" );
+ OSL_FAIL( "lcl_getCurrentExchangeType: unsupported (unexpected) exchange type!" );
return eEntry;
}
}
diff --git a/forms/source/component/imgprod.cxx b/forms/source/component/imgprod.cxx
index 39d025719297..702f7fca461b 100644
--- a/forms/source/component/imgprod.cxx
+++ b/forms/source/component/imgprod.cxx
@@ -204,9 +204,6 @@ ImageProducer::~ImageProducer()
delete mpStm;
mpStm = NULL;
-
- for( void* pCons = maConsList.First(); pCons; pCons = maConsList.Next() )
- delete (::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons;
}
// ------------------------------------------------------------
@@ -226,24 +223,17 @@ void ImageProducer::addConsumer( const ::com::sun::star::uno::Reference< ::com::
{
DBG_ASSERT( rxConsumer.is(), "::AddConsumer(...): No consumer referenced!" );
if( rxConsumer.is() )
- maConsList.Insert( new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > ( rxConsumer ), LIST_APPEND );
+ maConsList.push_back( new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > ( rxConsumer ));
}
// ------------------------------------------------------------
void ImageProducer::removeConsumer( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer >& rxConsumer ) throw(::com::sun::star::uno::RuntimeException)
{
- for( sal_uInt32 n = maConsList.Count(); n; )
- {
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > * pRef = (::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) maConsList.GetObject( --n );
+ ConsumerList_t::reverse_iterator riter = std::find(maConsList.rbegin(),maConsList.rend(),rxConsumer);
- if( *pRef == rxConsumer )
- {
- delete pRef;
- maConsList.Remove( n );
- break;
- }
- }
+ if (riter != maConsList.rend())
+ maConsList.erase(riter.base()-1);
}
// ------------------------------------------------------------
@@ -307,7 +297,7 @@ void ImageProducer::NewDataAvailable()
void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeException)
{
- if( maConsList.Count() || maDoneHdl.IsSet() )
+ if( !maConsList.empty() || maDoneHdl.IsSet() )
{
bool bNotifyEmptyGraphics = false;
@@ -333,24 +323,16 @@ void ImageProducer::startProduction() throw(::com::sun::star::uno::RuntimeExcept
if ( bNotifyEmptyGraphics )
{
// reset image
- List aTmp;
- void* pCons;
-
// create temporary list to hold interfaces
- for( pCons = maConsList.First(); pCons; pCons = maConsList.Next() )
- aTmp.Insert( new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons ), LIST_APPEND );
+ ConsumerList_t aTmp = maConsList;
// iterate through interfaces
- for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
+ for( ConsumerList_t::iterator iter = aTmp.begin(); iter != aTmp.end(); ++iter )
{
- ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->init( 0, 0 );
- ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->complete( ::com::sun::star::awt::ImageStatus::IMAGESTATUS_STATICIMAGEDONE, this );
+ (*iter)->init( 0, 0 );
+ (*iter)->complete( ::com::sun::star::awt::ImageStatus::IMAGESTATUS_STATICIMAGEDONE, this );
}
- // delete interfaces in temporary list
- for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
- delete (::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons;
-
if ( maDoneHdl.IsSet() )
maDoneHdl.Call( NULL );
}
@@ -380,25 +362,17 @@ void ImageProducer::ImplUpdateData( const Graphic& rGraphic )
{
ImplInitConsumer( rGraphic );
- if( mbConsInit && maConsList.Count() )
+ if( mbConsInit && !maConsList.empty() )
{
- List aTmp;
- void* pCons;
+ // create temporary list to hold interfaces
+ ConsumerList_t aTmp = maConsList;
ImplUpdateConsumer( rGraphic );
mbConsInit = sal_False;
- // create temporary list to hold interfaces
- for( pCons = maConsList.First(); pCons; pCons = maConsList.Next() )
- aTmp.Insert( new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons ), LIST_APPEND );
-
// iterate through interfaces
- for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
- ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->complete( ::com::sun::star::awt::ImageStatus::IMAGESTATUS_STATICIMAGEDONE, this );
-
- // delete interfaces in temporary list
- for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
- delete (::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons;
+ for( ConsumerList_t::iterator iter = aTmp.begin(); iter != aTmp.end(); ++iter )
+ (*iter)->complete( ::com::sun::star::awt::ImageStatus::IMAGESTATUS_STATICIMAGEDONE, this );
}
}
@@ -411,8 +385,6 @@ void ImageProducer::ImplInitConsumer( const Graphic& rGraphic )
if( pBmpAcc )
{
- List aTmp;
- void * pCons;
sal_uInt16 nPalCount = 0;
sal_uInt32 nRMask = 0;
sal_uInt32 nGMask = 0;
@@ -461,21 +433,15 @@ void ImageProducer::ImplInitConsumer( const Graphic& rGraphic )
}
// create temporary list to hold interfaces
- for( pCons = maConsList.First(); pCons; pCons = maConsList.Next() )
- aTmp.Insert( new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons ), LIST_APPEND );
+ ConsumerList_t aTmp = maConsList;
// iterate through interfaces
- for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
+ for( ConsumerList_t::iterator iter = aTmp.begin(); iter != aTmp.end(); ++iter)
{
- ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->init( pBmpAcc->Width(), pBmpAcc->Height() );
- ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->setColorModel( pBmpAcc->GetBitCount(),
- aRGBPal, nRMask, nGMask, nBMask, nAMask );
+ (*iter)->init( pBmpAcc->Width(), pBmpAcc->Height() );
+ (*iter)->setColorModel( pBmpAcc->GetBitCount(),aRGBPal, nRMask, nGMask, nBMask, nAMask );
}
- // delete interfaces in temporary list
- for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
- delete (::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons;
-
aBmp.ReleaseAccess( pBmpAcc );
mbConsInit = sal_True;
}
@@ -491,8 +457,6 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic )
if( pBmpAcc )
{
- List aTmp;
- void* pCons;
Bitmap aMask( aBmpEx.GetMask() );
BitmapReadAccess* pMskAcc = !!aMask ? aMask.AcquireReadAccess() : NULL;
const long nWidth = pBmpAcc->Width();
@@ -512,8 +476,7 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic )
}
// create temporary list to hold interfaces
- for( pCons = maConsList.First(); pCons; pCons = maConsList.Next() )
- aTmp.Insert( new ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons ), LIST_APPEND );
+ ConsumerList_t aTmp = maConsList;
if( pBmpAcc->HasPalette() )
{
@@ -537,9 +500,8 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic )
}
// iterate through interfaces
- for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
- ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->setPixelsByBytes( nStartX, nStartY, nPartWidth, nPartHeight,
- aData, 0UL, nPartWidth );
+ for (ConsumerList_t::iterator iter = aTmp.begin(); iter != aTmp.end(); ++iter)
+ (*iter)->setPixelsByBytes( nStartX, nStartY, nPartWidth, nPartHeight, aData, 0UL, nPartWidth );
}
else
{
@@ -558,9 +520,8 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic )
}
// iterate through interfaces
- for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
- ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->setPixelsByLongs( nStartX, nStartY, nPartWidth, nPartHeight,
- aData, 0UL, nPartWidth );
+ for (ConsumerList_t::iterator iter = aTmp.begin(); iter != aTmp.end(); ++iter)
+ (*iter)->setPixelsByLongs( nStartX, nStartY, nPartWidth, nPartHeight, aData, 0UL, nPartWidth );
}
}
else
@@ -585,15 +546,10 @@ void ImageProducer::ImplUpdateConsumer( const Graphic& rGraphic )
}
// iterate through interfaces
- for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
- ( *(::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons )->setPixelsByLongs( nStartX, nStartY, nPartWidth, nPartHeight,
- aData, 0UL, nPartWidth );
+ for (ConsumerList_t::iterator iter = aTmp.begin(); iter != aTmp.end(); ++iter)
+ (*iter)->setPixelsByLongs( nStartX, nStartY, nPartWidth, nPartHeight, aData, 0UL, nPartWidth );
}
- // delete interfaces in temporary list
- for( pCons = aTmp.First(); pCons; pCons = aTmp.Next() )
- delete (::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > *) pCons;
-
aBmp.ReleaseAccess( pBmpAcc );
aMask.ReleaseAccess( pMskAcc );
}
diff --git a/forms/source/component/imgprod.hxx b/forms/source/component/imgprod.hxx
index ee949ce56575..53d673cbe065 100644
--- a/forms/source/component/imgprod.hxx
+++ b/forms/source/component/imgprod.hxx
@@ -29,9 +29,10 @@
#ifndef _PRODUCE_HXX
#define _PRODUCE_HXX
+#include <boost/ptr_container/ptr_vector.hpp>
+
#include <tools/link.hxx>
#include <tools/string.hxx>
-#include <tools/list.hxx>
#include <com/sun/star/awt/ImageStatus.hpp>
#include <com/sun/star/awt/XImageConsumer.hpp>
#include <com/sun/star/awt/XImageProducer.hpp>
@@ -61,8 +62,10 @@ class ImageProducer : public ::com::sun::star::awt::XImageProducer,
{
private:
+ typedef boost::ptr_vector< ::com::sun::star::uno::Reference< ::com::sun::star::awt::XImageConsumer > > ConsumerList_t;
+
::rtl::OUString maURL;
- List maConsList;
+ ConsumerList_t maConsList;
Graphic* mpGraphic;
SvStream* mpStm;
sal_uInt32 mnTransIndex;
diff --git a/forms/source/component/refvaluecomponent.cxx b/forms/source/component/refvaluecomponent.cxx
index ab32ff5bcce3..9fdf49d5117d 100644
--- a/forms/source/component/refvaluecomponent.cxx
+++ b/forms/source/component/refvaluecomponent.cxx
@@ -218,7 +218,7 @@ namespace frm
}
else
{
- OSL_ENSURE( false, "OReferenceValueComponent::translateExternalValueToControlValue: unexpected value type!" );
+ OSL_FAIL( "OReferenceValueComponent::translateExternalValueToControlValue: unexpected value type!" );
}
return makeAny( nState );