diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-03 08:39:03 +0200 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2016-07-20 01:26:04 -0400 |
commit | a0e8e05008e143ee5e3bbc281d1c253c7e5ed136 (patch) | |
tree | eaf5f70a067fd48704addd9f2b582624a2fb44ae /basctl | |
parent | 9c7cae1561cfe16226b1f16dce59f08a38da3ce0 (diff) |
use Any constructor instead of temporaries
(cherry picked from commit 58a32075ca4f457f570af75aef368dd6c389aca7)
Change-Id: Iffb82a2cee1a28d89eeea2b905aaa14086ee475a
Diffstat (limited to 'basctl')
-rw-r--r-- | basctl/source/basicide/baside3.cxx | 4 | ||||
-rw-r--r-- | basctl/source/basicide/localizationmgr.cxx | 37 | ||||
-rw-r--r-- | basctl/source/dlged/dlged.cxx | 12 | ||||
-rw-r--r-- | basctl/source/dlged/dlgedfac.cxx | 8 | ||||
-rw-r--r-- | basctl/source/dlged/dlgedobj.cxx | 73 |
5 files changed, 39 insertions, 95 deletions
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index 915c19d5b410..88c27877b00d 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -1172,9 +1172,7 @@ bool implImportDialog( vcl::Window* pWin, const OUString& rCurPath, const Script { try { - Any aXmlDialogNameAny; - aXmlDialogNameAny <<= OUString( aNewDlgName ); - xDialogModelPropSet->setPropertyValue( DLGED_PROP_NAME, aXmlDialogNameAny ); + xDialogModelPropSet->setPropertyValue( DLGED_PROP_NAME, Any(aNewDlgName) ); bRenamed = true; } catch(const beans::UnknownPropertyException& ) diff --git a/basctl/source/basicide/localizationmgr.cxx b/basctl/source/basicide/localizationmgr.cxx index b109e68b4724..a6adbf8f5a04 100644 --- a/basctl/source/basicide/localizationmgr.cxx +++ b/basctl/source/basicide/localizationmgr.cxx @@ -247,12 +247,10 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties xStringResourceManager->setStringForLocale( aPureIdStr, aPropStr, rLocale ); } - OUString aPropIdStr = aEsc; - aPropIdStr += aPureIdStr; + OUString aPropIdStr = aEsc + aPureIdStr; // TODO?: Change here and in toolkit (void)aSemi; - aPropAny <<= aPropIdStr; - xPropertySet->setPropertyValue( aPropName, aPropAny ); + xPropertySet->setPropertyValue( aPropName, Any(aPropIdStr) ); } // Replace id by string from StringResource else if( eMode == RESET_IDS ) @@ -268,8 +266,7 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties catch(const MissingResourceException&) { } - aPropAny <<= aNewPropStr; - xPropertySet->setPropertyValue( aPropName, aPropAny ); + xPropertySet->setPropertyValue( aPropName, Any(aNewPropStr) ); } } // Remove Id for all locales @@ -319,12 +316,10 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties {} } - OUString aPropIdStr = aEsc; - aPropIdStr += aPureIdStr; + OUString aPropIdStr = aEsc + aPureIdStr; // TODO?: Change here and in toolkit (void)aSemi; - aPropAny <<= aPropIdStr; - xPropertySet->setPropertyValue( aPropName, aPropAny ); + xPropertySet->setPropertyValue( aPropName, Any(aPropIdStr) ); } // Replace string by string from source StringResourceResolver else if( eMode == MOVE_RESOURCES && xSourceStringResolver.is() ) @@ -356,12 +351,10 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties xStringResourceManager->setStringForLocale( aPureIdStr, aResStr, rLocale ); } - OUString aPropIdStr = aEsc; - aPropIdStr += aPureIdStr; + OUString aPropIdStr = aEsc + aPureIdStr; // TODO?: Change here and in toolkit (void)aSemi; - aPropAny <<= aPropIdStr; - xPropertySet->setPropertyValue( aPropName, aPropAny ); + xPropertySet->setPropertyValue( aPropName, Any(aPropIdStr) ); } // Copy string from source to target resource else if( eMode == COPY_RESOURCES && xSourceStringResolver.is() ) @@ -444,8 +437,7 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties aPropIdStr += aPureIdStr; pIdStrings[i] = aPropIdStr; } - aPropAny <<= aIdStrings; - xPropertySet->setPropertyValue( aPropName, aPropAny ); + xPropertySet->setPropertyValue( aPropName, Any(aIdStrings) ); } // Replace id by string from StringResource else if( eMode == RESET_IDS ) @@ -472,8 +464,7 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties } pNewPropStrings[i] = aNewPropStr; } - aPropAny <<= aNewPropStrings; - xPropertySet->setPropertyValue( aPropName, aPropAny ); + xPropertySet->setPropertyValue( aPropName, Any(aNewPropStrings) ); } // Remove Id for all locales else if( eMode == REMOVE_IDS_FROM_RESOURCE ) @@ -548,8 +539,7 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties aPropIdStr += aPureIdStr; pIdStrings[i] = aPropIdStr; } - aPropAny <<= aIdStrings; - xPropertySet->setPropertyValue( aPropName, aPropAny ); + xPropertySet->setPropertyValue( aPropName, Any(aIdStrings) ); } // Replace string by string from source StringResourceResolver else if( eMode == MOVE_RESOURCES && xSourceStringResolver.is() ) @@ -599,8 +589,7 @@ sal_Int32 LocalizationMgr::implHandleControlResourceProperties aPropIdStr += aPureIdStr; pIdStrings[i] = aPropIdStr; } - aPropAny <<= aIdStrings; - xPropertySet->setPropertyValue( aPropName, aPropAny ); + xPropertySet->setPropertyValue( aPropName, Any(aIdStrings) ); } // Copy string from source to target resource else if( eMode == COPY_RESOURCES && xSourceStringResolver.is() ) @@ -924,9 +913,7 @@ void LocalizationMgr::setStringResourceAtDialog( const ScriptDocument& rDocument } Reference< beans::XPropertySet > xDlgPSet( xDialogModel, UNO_QUERY ); - Any aStringResourceManagerAny; - aStringResourceManagerAny <<= xStringResourceManager; - xDlgPSet->setPropertyValue( aResourceResolverPropName, aStringResourceManagerAny ); + xDlgPSet->setPropertyValue( aResourceResolverPropName, Any(xStringResourceManager) ); } } diff --git a/basctl/source/dlged/dlged.cxx b/basctl/source/dlged/dlged.cxx index 2cf25fa54d73..a5327ae2298b 100644 --- a/basctl/source/dlged/dlged.cxx +++ b/basctl/source/dlged/dlged.cxx @@ -794,9 +794,7 @@ void DlgEditor::Copy() memcpy( pCombinedData + 4, DialogModelBytes.getConstArray(), nDialogDataLen ); memcpy( pCombinedData + nResOffset, aResData.getConstArray(), nResDataLen ); - Any aCombinedDataAny; - aCombinedDataAny <<= aCombinedData; - aSeqData[1] = aCombinedDataAny; + aSeqData[1] = Any(aCombinedData); pTrans = new DlgEdTransferableImpl( m_ClipboardDataFlavorsResource, aSeqData ); } @@ -935,16 +933,12 @@ void DlgEditor::Paste() // set new name OUString aOUniqueName( pCtrlObj->GetUniqueName() ); Reference< beans::XPropertySet > xPSet( xCtrlModel , UNO_QUERY ); - Any aUniqueName; - aUniqueName <<= aOUniqueName; - xPSet->setPropertyValue( DLGED_PROP_NAME, aUniqueName ); + xPSet->setPropertyValue( DLGED_PROP_NAME, Any(aOUniqueName) ); // set tabindex Reference< container::XNameAccess > xNA( m_xUnoControlDialogModel , UNO_QUERY ); Sequence< OUString > aNames_ = xNA->getElementNames(); - Any aTabIndex; - aTabIndex <<= (sal_Int16) aNames_.getLength(); - xPSet->setPropertyValue( DLGED_PROP_TABINDEX, aTabIndex ); + xPSet->setPropertyValue( DLGED_PROP_TABINDEX, Any((sal_Int16) aNames_.getLength()) ); if( bLocalized ) { diff --git a/basctl/source/dlged/dlgedfac.cxx b/basctl/source/dlged/dlgedfac.cxx index 83d3d48da8b2..023989ce4679 100644 --- a/basctl/source/dlged/dlgedfac.cxx +++ b/basctl/source/dlged/dlgedfac.cxx @@ -167,9 +167,7 @@ IMPL_LINK_TYPED( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory, void ) uno::Reference< beans::XPropertySet > xPSet(pNew->GetUnoControlModel(), uno::UNO_QUERY); if (xPSet.is()) { - uno::Any aValue; - aValue <<= (sal_Int32) css::awt::ScrollBarOrientation::VERTICAL; - xPSet->setPropertyValue( DLGED_PROP_ORIENTATION, aValue ); + xPSet->setPropertyValue( DLGED_PROP_ORIENTATION, uno::Any((sal_Int32) css::awt::ScrollBarOrientation::VERTICAL) ); } } catch(...) @@ -189,9 +187,7 @@ IMPL_LINK_TYPED( DlgEdFactory, MakeObject, SdrObjFactory *, pObjFactory, void ) uno::Reference< beans::XPropertySet > xPSet(pNew->GetUnoControlModel(), uno::UNO_QUERY); if (xPSet.is()) { - uno::Any aValue; - aValue <<= (sal_Int32) 1; - xPSet->setPropertyValue( DLGED_PROP_ORIENTATION, aValue ); + xPSet->setPropertyValue( DLGED_PROP_ORIENTATION, uno::Any((sal_Int32) 1) ); } } catch(...) diff --git a/basctl/source/dlged/dlgedobj.cxx b/basctl/source/dlged/dlgedobj.cxx index 86786e8f7dc6..dd946113d0fc 100644 --- a/basctl/source/dlged/dlgedobj.cxx +++ b/basctl/source/dlged/dlgedobj.cxx @@ -369,15 +369,10 @@ void DlgEdObj::SetPropsFromRect() Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY ); if ( xPSet.is() ) { - Any aValue; - aValue <<= nXOut; - xPSet->setPropertyValue( DLGED_PROP_POSITIONX, aValue ); - aValue <<= nYOut; - xPSet->setPropertyValue( DLGED_PROP_POSITIONY, aValue ); - aValue <<= nWidthOut; - xPSet->setPropertyValue( DLGED_PROP_WIDTH, aValue ); - aValue <<= nHeightOut; - xPSet->setPropertyValue( DLGED_PROP_HEIGHT, aValue ); + xPSet->setPropertyValue( DLGED_PROP_POSITIONX, Any(nXOut) ); + xPSet->setPropertyValue( DLGED_PROP_POSITIONY, Any(nYOut) ); + xPSet->setPropertyValue( DLGED_PROP_WIDTH, Any(nWidthOut) ); + xPSet->setPropertyValue( DLGED_PROP_HEIGHT, Any(nHeightOut) ); } } } @@ -439,10 +434,8 @@ void DlgEdObj::PositionAndSizeChange( const beans::PropertyChangeEvent& evt ) if ( nNewValue != nValue ) { - Any aNewValue; - aNewValue <<= nNewValue; EndListening( false ); - xPSet->setPropertyValue( evt.PropertyName, aNewValue ); + xPSet->setPropertyValue( evt.PropertyName, Any(nNewValue) ); StartListening(); } } @@ -489,9 +482,7 @@ void SAL_CALL DlgEdObj::NameChange( const css::beans::PropertyChangeEvent& evt // set old name property EndListening(false); Reference< beans::XPropertySet > xPSet(GetUnoControlModel(), UNO_QUERY); - Any aName; - aName <<= aOldName; - xPSet->setPropertyValue( DLGED_PROP_NAME, aName ); + xPSet->setPropertyValue( DLGED_PROP_NAME, Any(aOldName) ); StartListening(); } } @@ -610,9 +601,7 @@ void DlgEdObj::TabIndexChange( const beans::PropertyChangeEvent& evt ) throw (Ru aCtrl >>= xPSet; if ( xPSet.is() ) { - Any aTabIndex; - aTabIndex <<= (sal_Int16) i; - xPSet->setPropertyValue( DLGED_PROP_TABINDEX, aTabIndex ); + xPSet->setPropertyValue( DLGED_PROP_TABINDEX, Any((sal_Int16) i) ); } } @@ -885,15 +874,11 @@ void DlgEdObj::clonedFrom(const DlgEdObj* _pSource) { // set tabindex Sequence< OUString > aNames = xCont->getElementNames(); - Any aTabIndex; - aTabIndex <<= (sal_Int16) aNames.getLength(); - xPSet->setPropertyValue( DLGED_PROP_TABINDEX, aTabIndex ); + xPSet->setPropertyValue( DLGED_PROP_TABINDEX, Any((sal_Int16) aNames.getLength()) ); // insert control model in dialog model Reference< awt::XControlModel > xCtrl( xPSet , UNO_QUERY ); - Any aCtrl; - aCtrl <<= xCtrl; - xCont->insertByName( aOUniqueName , aCtrl ); + xCont->insertByName( aOUniqueName, Any(xCtrl) ); pDlgEdForm->UpdateTabOrderAndGroups(); } @@ -984,9 +969,7 @@ void DlgEdObj::SetDefaults() OUString aOUniqueName( GetUniqueName() ); // set name property - Any aUniqueName; - aUniqueName <<= aOUniqueName; - xPSet->setPropertyValue( DLGED_PROP_NAME, aUniqueName ); + xPSet->setPropertyValue( DLGED_PROP_NAME, Any(aOUniqueName) ); // set labels if ( supportsService( "com.sun.star.awt.UnoControlButtonModel" ) || @@ -995,7 +978,7 @@ void DlgEdObj::SetDefaults() supportsService( "com.sun.star.awt.UnoControlGroupBoxModel" ) || supportsService( "com.sun.star.awt.UnoControlFixedTextModel" ) ) { - xPSet->setPropertyValue( DLGED_PROP_LABEL, aUniqueName ); + xPSet->setPropertyValue( DLGED_PROP_LABEL, Any(aOUniqueName) ); } // set number formats supplier for formatted field @@ -1004,9 +987,7 @@ void DlgEdObj::SetDefaults() Reference< util::XNumberFormatsSupplier > xSupplier = GetDlgEdForm()->GetDlgEditor().GetNumberFormatsSupplier(); if ( xSupplier.is() ) { - Any aSupplier; - aSupplier <<= xSupplier; - xPSet->setPropertyValue( DLGED_PROP_FORMATSSUPPLIER, aSupplier ); + xPSet->setPropertyValue( DLGED_PROP_FORMATSSUPPLIER, Any(xSupplier) ); } } @@ -1267,15 +1248,10 @@ void DlgEdForm::SetPropsFromRect() Reference< beans::XPropertySet > xPSet( GetUnoControlModel(), UNO_QUERY ); if ( xPSet.is() ) { - Any aValue; - aValue <<= nXOut; - xPSet->setPropertyValue( DLGED_PROP_POSITIONX, aValue ); - aValue <<= nYOut; - xPSet->setPropertyValue( DLGED_PROP_POSITIONY, aValue ); - aValue <<= nWidthOut; - xPSet->setPropertyValue( DLGED_PROP_WIDTH, aValue ); - aValue <<= nHeightOut; - xPSet->setPropertyValue( DLGED_PROP_HEIGHT, aValue ); + xPSet->setPropertyValue( DLGED_PROP_POSITIONX, Any(nXOut) ); + xPSet->setPropertyValue( DLGED_PROP_POSITIONY, Any(nYOut) ); + xPSet->setPropertyValue( DLGED_PROP_WIDTH, Any(nWidthOut) ); + xPSet->setPropertyValue( DLGED_PROP_HEIGHT, Any(nHeightOut) ); } } } @@ -1333,10 +1309,8 @@ void DlgEdForm::PositionAndSizeChange( const beans::PropertyChangeEvent& evt ) if ( nNewValue != nValue ) { - Any aNewValue; - aNewValue <<= nNewValue; EndListening( false ); - xPSetForm->setPropertyValue( evt.PropertyName, aNewValue ); + xPSetForm->setPropertyValue( evt.PropertyName, Any(nNewValue) ); StartListening(); } } @@ -1375,10 +1349,8 @@ void DlgEdForm::PositionAndSizeChange( const beans::PropertyChangeEvent& evt ) } if ( nNewX != nX ) { - Any aValue; - aValue <<= nNewX; EndListening( false ); - xPSet->setPropertyValue( DLGED_PROP_POSITIONX, aValue ); + xPSet->setPropertyValue( DLGED_PROP_POSITIONX, Any(nNewX) ); StartListening(); } @@ -1391,10 +1363,8 @@ void DlgEdForm::PositionAndSizeChange( const beans::PropertyChangeEvent& evt ) } if ( nNewY != nY ) { - Any aValue; - aValue <<= nNewY; EndListening( false ); - xPSet->setPropertyValue( DLGED_PROP_POSITIONY, aValue ); + xPSet->setPropertyValue( DLGED_PROP_POSITIONY, Any(nNewY) ); StartListening(); } } @@ -1467,9 +1437,8 @@ void DlgEdForm::UpdateTabIndices() aCtrl >>= xPSet; if ( xPSet.is() ) { - Any aTabIndex; - aTabIndex <<= (sal_Int16) nNewTabIndex++; - xPSet->setPropertyValue( DLGED_PROP_TABINDEX, aTabIndex ); + xPSet->setPropertyValue( DLGED_PROP_TABINDEX, Any((sal_Int16) nNewTabIndex) ); + nNewTabIndex++; } } |