diff options
21 files changed, 42 insertions, 26 deletions
diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index cbeac3c979ce..c2b0e793df8a 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -2206,7 +2206,7 @@ SbObjModule::SetUnoObject( const uno::Any& aObj ) throw ( uno::RuntimeException SbUnoObject* pUnoObj = PTR_CAST(SbUnoObject,(SbxVariable*)pDocObject); if ( pUnoObj && pUnoObj->getUnoAny() == aObj ) // object is equal, nothing to do return; - pDocObject = new SbUnoObject( GetName(), uno::makeAny( aObj ) ); + pDocObject = new SbUnoObject( GetName(), aObj ); com::sun::star::uno::Reference< com::sun::star::lang::XServiceInfo > xServiceInfo( aObj, com::sun::star::uno::UNO_QUERY_THROW ); if( xServiceInfo->supportsService( "ooo.vba.excel.Worksheet" ) ) diff --git a/canvas/source/tools/canvastools.cxx b/canvas/source/tools/canvastools.cxx index 7b3ae29f4e15..7db3572b4dae 100644 --- a/canvas/source/tools/canvastools.cxx +++ b/canvas/source/tools/canvastools.cxx @@ -1167,7 +1167,7 @@ namespace canvas o_rxParams.realloc( 2 ); o_rxParams[ 0 ] = uno::makeAny( xServiceInfo->getImplementationName() ); - o_rxParams[ 1 ] = uno::makeAny( xPropSet->getPropertyValue( "DeviceHandle" ) ); + o_rxParams[ 1 ] = xPropSet->getPropertyValue( "DeviceHandle" ); } catch( const uno::Exception& ) { diff --git a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx index b23f85e4f861..159f0fbb646f 100644 --- a/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx +++ b/dbaccess/source/ui/tabledesign/FieldDescriptions.cxx @@ -286,7 +286,7 @@ void OFieldDescription::SetDefaultValue(const Any& _rDefaultValue) try { if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_DEFAULTVALUE) ) - m_xDest->setPropertyValue(PROPERTY_DEFAULTVALUE,makeAny(_rDefaultValue)); + m_xDest->setPropertyValue(PROPERTY_DEFAULTVALUE, _rDefaultValue); else m_aDefaultValue = _rDefaultValue; } @@ -301,7 +301,7 @@ void OFieldDescription::SetControlDefault(const Any& _rControlDefault) try { if ( m_xDest.is() && m_xDestInfo->hasPropertyByName(PROPERTY_CONTROLDEFAULT) ) - m_xDest->setPropertyValue(PROPERTY_CONTROLDEFAULT,makeAny(_rControlDefault)); + m_xDest->setPropertyValue(PROPERTY_CONTROLDEFAULT, _rControlDefault); else m_aControlDefault = _rControlDefault; } diff --git a/extensions/source/propctrlr/formgeometryhandler.cxx b/extensions/source/propctrlr/formgeometryhandler.cxx index 6e16c3700b82..0196d3f8dae2 100644 --- a/extensions/source/propctrlr/formgeometryhandler.cxx +++ b/extensions/source/propctrlr/formgeometryhandler.cxx @@ -744,11 +744,11 @@ namespace pcr } else if ( _event.PropertyName == PROPERTY_ANCHOR_TYPE ) { - aEventTranslations.push_back( EventTranslation( PROPERTY_TEXT_ANCHOR_TYPE, makeAny( _event.NewValue ) ) ); + aEventTranslations.push_back( EventTranslation( PROPERTY_TEXT_ANCHOR_TYPE, _event.NewValue ) ); } else if ( _event.PropertyName == PROPERTY_ANCHOR ) { - aEventTranslations.push_back( EventTranslation( PROPERTY_SHEET_ANCHOR_TYPE, makeAny( _event.NewValue ) ) ); + aEventTranslations.push_back( EventTranslation( PROPERTY_SHEET_ANCHOR_TYPE, _event.NewValue ) ); } PropertyChangeEvent aTranslatedEvent( _event ); diff --git a/include/com/sun/star/uno/Any.h b/include/com/sun/star/uno/Any.h index 3ab2a4486647..13547409d7e8 100644 --- a/include/com/sun/star/uno/Any.h +++ b/include/com/sun/star/uno/Any.h @@ -260,6 +260,19 @@ inline Any SAL_CALL makeAny( const C & value ); template<> inline Any SAL_CALL makeAny( bool const & value ); +template<> Any SAL_CALL makeAny(Any const &) SAL_DELETED_FUNCTION; + +/** Wrap a value in an Any, if necessary. + + The difference to makeAny is that makeAny cannot be called on an Any, while + toAny just returns the given Any. + + @since LibreOffice 4.5 +*/ +template<typename T> inline Any toAny(T const & value); + +template<> inline Any toAny(Any const & value); + class BaseReference; /** Template binary <<= operator to set the value of an any. diff --git a/include/com/sun/star/uno/Any.hxx b/include/com/sun/star/uno/Any.hxx index 2b314e976b6f..f4b4db91b806 100644 --- a/include/com/sun/star/uno/Any.hxx +++ b/include/com/sun/star/uno/Any.hxx @@ -204,6 +204,10 @@ inline Any SAL_CALL makeAny( const rtl::OUStringConcat< C1, C2 >& value ) } #endif +template<typename T> Any toAny(T const & value) { return makeAny(value); } + +template<> Any toAny(Any const & value) { return value; } + template< class C > inline void SAL_CALL operator <<= ( Any & rAny, const C & value ) { diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx index f09ff1c67af1..fcaab6b48c78 100644 --- a/include/comphelper/sequence.hxx +++ b/include/comphelper/sequence.hxx @@ -198,10 +198,9 @@ namespace comphelper template <class TYPE> inline ::com::sun::star::uno::Any OSequenceIterator<TYPE>::nextElement() { - return ::com::sun::star::uno::makeAny(*m_pCurrent++); + return ::com::sun::star::uno::toAny(*m_pCurrent++); } - /** Copy from a plain C/C++ array into a Sequence. @tpl SrcType diff --git a/include/comphelper/sequenceashashmap.hxx b/include/comphelper/sequenceashashmap.hxx index 801d2d19a1fd..32e67b784257 100644 --- a/include/comphelper/sequenceashashmap.hxx +++ b/include/comphelper/sequenceashashmap.hxx @@ -265,7 +265,7 @@ class COMPHELPER_DLLPUBLIC SequenceAsHashMap : public SequenceAsHashMapBase { if (find(sKey) == end()) { - (*this)[sKey] = ::com::sun::star::uno::makeAny(aValue); + (*this)[sKey] = ::com::sun::star::uno::toAny(aValue); return true; } diff --git a/oox/source/helper/propertymap.cxx b/oox/source/helper/propertymap.cxx index 792de08e2598..9db0e0991199 100644 --- a/oox/source/helper/propertymap.cxx +++ b/oox/source/helper/propertymap.cxx @@ -670,7 +670,7 @@ static const char* lclDumpAnyValueCode( Any value, int level = 0) for( int i=0; i<adjArray.getLength(); i++ ) { printLevel (level); fprintf (stderr, "{\n"); - const char *var = lclDumpAnyValueCode( makeAny (adjArray[i].Value), level + 1 ); + const char *var = lclDumpAnyValueCode( adjArray[i].Value, level + 1 ); printLevel (level + 1); fprintf (stderr, "aAdjSequence [%d].Value = %s;\n", i, var); if (adjArray[i].Name.getLength() > 0) { diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 15d5f9469a67..ca47523d560d 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -950,7 +950,7 @@ sal_Bool SAL_CALL ZipPackage::hasByHierarchicalName( const OUString& aName ) uno::Any e(::cppu::getCaughtException()); throw lang::WrappedTargetRuntimeException( OUString("ZipPackage::hasByHierarchicalName"), - 0, uno::makeAny(e)); + 0, e); } return sal_False; } diff --git a/pyuno/source/module/pyuno.cxx b/pyuno/source/module/pyuno.cxx index 3ec1316b123c..7020004afb88 100644 --- a/pyuno/source/module/pyuno.cxx +++ b/pyuno/source/module/pyuno.cxx @@ -513,7 +513,7 @@ PyObject* PyUNO_getattr (PyObject* self, char* name) } catch( const com::sun::star::reflection::InvocationTargetException & e ) { - raisePyExceptionWithAny( makeAny(e.TargetException) ); + raisePyExceptionWithAny( e.TargetException ); } catch( const com::sun::star::beans::UnknownPropertyException & e ) { @@ -557,7 +557,7 @@ int PyUNO_setattr (PyObject* self, char* name, PyObject* value) } catch( const com::sun::star::reflection::InvocationTargetException & e ) { - raisePyExceptionWithAny( makeAny(e.TargetException) ); + raisePyExceptionWithAny( e.TargetException ); return 1; } catch( const com::sun::star::beans::UnknownPropertyException & e ) diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index a0013a317c11..6dd1419c57e2 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -2351,7 +2351,7 @@ uno::Any SAL_CALL OStylesHelper::getByIndex( sal_Int32 Index ) throw(lang::Index ::osl::MutexGuard aGuard(m_aMutex); if ( Index < 0 || Index >= static_cast<sal_Int32>(m_aElementsPos.size()) ) throw lang::IndexOutOfBoundsException(); - return uno::makeAny(m_aElementsPos[Index]->second); + return m_aElementsPos[Index]->second; } // container::XNameAccess @@ -2361,7 +2361,7 @@ uno::Any SAL_CALL OStylesHelper::getByName( const OUString& aName ) throw(contai TStyleElements::iterator aFind = m_aElements.find(aName); if ( aFind == m_aElements.end() ) throw container::NoSuchElementException(); - return uno::makeAny(aFind->second); + return aFind->second; } uno::Sequence< OUString > SAL_CALL OStylesHelper::getElementNames( ) throw(uno::RuntimeException, std::exception) diff --git a/sc/source/ui/vba/vbainterior.cxx b/sc/source/ui/vba/vbainterior.cxx index 1d0d322b6368..8647f9505b65 100644 --- a/sc/source/ui/vba/vbainterior.cxx +++ b/sc/source/ui/vba/vbainterior.cxx @@ -366,7 +366,7 @@ ScVbaInterior::getPatternColorIndex() throw (uno::RuntimeException, std::excepti sal_Int32 nColor = 0; XLRGBToOORGB( getPatternColor() ) >>= nColor; - return uno::makeAny( GetIndexColor( nColor ) ); + return GetIndexColor( nColor ); } void SAL_CALL ScVbaInterior::setPatternColorIndex( const uno::Any& _patterncolorindex ) throw (uno::RuntimeException, std::exception) diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx index 49b8c7f6d5ee..d60e10a25dff 100644 --- a/sc/source/ui/vba/vbaworksheet.cxx +++ b/sc/source/ui/vba/vbaworksheet.cxx @@ -934,7 +934,7 @@ ScVbaWorksheet::invoke( const OUString& aFunctionName, const uno::Sequence< uno: void SAL_CALL ScVbaWorksheet::setValue( const OUString& aPropertyName, const uno::Any& aValue ) throw (beans::UnknownPropertyException, script::CannotConvertException, reflection::InvocationTargetException, uno::RuntimeException, std::exception) { - setDefaultPropByIntrospection( uno::makeAny( getValue( aPropertyName ) ), aValue ); + setDefaultPropByIntrospection( getValue( aPropertyName ), aValue ); } uno::Any SAL_CALL ScVbaWorksheet::getValue( const OUString& aPropertyName ) throw (beans::UnknownPropertyException, uno::RuntimeException, std::exception) diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index 97f9559bf5c6..7ad5e3f30c03 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -1370,12 +1370,12 @@ void CustomAnimationEffectTabPage::update( STLPropertySet* pSet ) if ( mpCLBDimColor->GetSelectEntryPos() != LISTBOX_ENTRY_NOTFOUND ) aSelectedColor = mpCLBDimColor->GetSelectEntryColor(); - aDimColor = makeAny( makeAny( (sal_Int32)aSelectedColor.GetRGBColor() ) ); + aDimColor = makeAny( (sal_Int32)aSelectedColor.GetRGBColor() ); } if( (mpSet->getPropertyState( nHandleDimColor ) == STLPropertyState_AMBIGUOUS) || (mpSet->getPropertyValue( nHandleDimColor ) != aDimColor) ) - pSet->setPropertyValue( nHandleDimColor, makeAny( aDimColor ) ); + pSet->setPropertyValue( nHandleDimColor, aDimColor ); bool bAfterEffectOnNextEffect = nPos != 2 ? sal_True : sal_False; bool bOldAfterEffectOnNextEffect = !bAfterEffectOnNextEffect; diff --git a/sd/source/ui/animations/CustomAnimationPane.cxx b/sd/source/ui/animations/CustomAnimationPane.cxx index b7087f969963..f327dc95bfc5 100644 --- a/sd/source/ui/animations/CustomAnimationPane.cxx +++ b/sd/source/ui/animations/CustomAnimationPane.cxx @@ -1068,7 +1068,7 @@ STLPropertySet* CustomAnimationPane::createSelectionSet() addValue( pSet, nHandleBegin, makeAny( pEffect->getBegin() ) ); addValue( pSet, nHandleDuration, makeAny( pEffect->getDuration() ) ); addValue( pSet, nHandleStart, makeAny( pEffect->getNodeType() ) ); - addValue( pSet, nHandleRepeat, makeAny( pEffect->getRepeatCount() ) ); + addValue( pSet, nHandleRepeat, pEffect->getRepeatCount() ); addValue( pSet, nHandleEnd, pEffect->getEnd() ); addValue( pSet, nHandleRewind, makeAny( pEffect->getFill() ) ); diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index b1fff82abd9d..59a4428e217c 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -1154,7 +1154,7 @@ uno::Any SwXCell::getPropertyValue(const OUString& rPropertyName) case FN_UNO_REDLINE_NODE_END: { //redline can only be returned if it's a living object - return makeAny(SwXText::getPropertyValue(rPropertyName)); + return SwXText::getPropertyValue(rPropertyName); } break; default: diff --git a/vbahelper/source/msforms/vbamultipage.cxx b/vbahelper/source/msforms/vbamultipage.cxx index 4fa287efbc3d..2fb7016ac02e 100644 --- a/vbahelper/source/msforms/vbamultipage.cxx +++ b/vbahelper/source/msforms/vbamultipage.cxx @@ -102,7 +102,7 @@ ScVbaMultiPage::Pages( const uno::Any& index ) throw (uno::RuntimeException, std uno::Reference< XCollection > xColl( new ScVbaPages( this, mxContext, getPages( xContainer->getElementNames().getLength() ) ) ); if ( !index.hasValue() ) return uno::makeAny( xColl ); - return xColl->Item( uno::makeAny( index ), uno::Any() ); + return xColl->Item( index, uno::Any() ); } uno::Sequence< OUString > diff --git a/vbahelper/source/msforms/vbauserform.cxx b/vbahelper/source/msforms/vbauserform.cxx index 23bbd23f80be..8b6fe02e666f 100644 --- a/vbahelper/source/msforms/vbauserform.cxx +++ b/vbahelper/source/msforms/vbauserform.cxx @@ -285,7 +285,7 @@ ScVbaUserForm::Controls( const uno::Any& index ) throw (uno::RuntimeException, s uno::Reference< awt::XControl > xDialogControl( m_xDialog, uno::UNO_QUERY ); uno::Reference< XCollection > xControls( new ScVbaControls( this, mxContext, xDialogControl, m_xModel, mpGeometryHelper->getOffsetX(), mpGeometryHelper->getOffsetY() ) ); if ( index.hasValue() ) - return uno::makeAny( xControls->Item( index, uno::Any() ) ); + return xControls->Item( index, uno::Any() ); return uno::makeAny( xControls ); } diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index 589c02917050..57f62684b581 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -293,7 +293,7 @@ VbaApplicationBase::CommandBars( const uno::Any& aIndex ) throw (uno::RuntimeExc { uno::Reference< XCommandBars > xCommandBars( new ScVbaCommandBars( this, mxContext, uno::Reference< container::XIndexAccess >(), getCurrentDocument() ) ); if( aIndex.hasValue() ) - return uno::makeAny( xCommandBars->Item( aIndex, uno::Any() ) ); + return xCommandBars->Item( aIndex, uno::Any() ); return uno::makeAny( xCommandBars ); } diff --git a/writerfilter/source/dmapper/DomainMapper.cxx b/writerfilter/source/dmapper/DomainMapper.cxx index b64e2165bc25..32528c564f5e 100644 --- a/writerfilter/source/dmapper/DomainMapper.cxx +++ b/writerfilter/source/dmapper/DomainMapper.cxx @@ -2519,7 +2519,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) resolveSprmProps(*this, rSprm); TablePropertyMapPtr pPropMap(new TablePropertyMap()); - pPropMap->Insert(PROP_ROW_CNF_STYLE, uno::makeAny(uno::makeAny(comphelper::containerToSequence(m_pImpl->m_aInteropGrabBag))), true, ROW_GRAB_BAG); + pPropMap->Insert(PROP_ROW_CNF_STYLE, uno::makeAny(comphelper::containerToSequence(m_pImpl->m_aInteropGrabBag)), true, ROW_GRAB_BAG); m_pImpl->getTableManager().insertRowProps(pPropMap); m_pImpl->disableInteropGrabBag(); @@ -2531,7 +2531,7 @@ void DomainMapper::sprmWithProps( Sprm& rSprm, PropertyMapPtr rContext ) resolveSprmProps(*this, rSprm); TablePropertyMapPtr pPropMap(new TablePropertyMap()); - pPropMap->Insert(PROP_CELL_CNF_STYLE, uno::makeAny(uno::makeAny(comphelper::containerToSequence(m_pImpl->m_aInteropGrabBag))), true, CELL_GRAB_BAG); + pPropMap->Insert(PROP_CELL_CNF_STYLE, uno::makeAny(comphelper::containerToSequence(m_pImpl->m_aInteropGrabBag)), true, CELL_GRAB_BAG); m_pImpl->getTableManager().cellProps(pPropMap); m_pImpl->disableInteropGrabBag(); |