summaryrefslogtreecommitdiff
path: root/basctl
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-03 08:39:03 +0200
committerNoel Grandin <noel@peralex.com>2016-05-04 12:39:40 +0200
commit58a32075ca4f457f570af75aef368dd6c389aca7 (patch)
treee437dcbdeb248b4316cb8a9281d1543419853f6d /basctl
parent7d47700972d267fe7c5270c5dadd45a523a2baec (diff)
use Any constructor instead of temporaries
Change-Id: Iffb82a2cee1a28d89eeea2b905aaa14086ee475a
Diffstat (limited to 'basctl')
-rw-r--r--basctl/source/basicide/baside3.cxx4
-rw-r--r--basctl/source/basicide/localizationmgr.cxx37
-rw-r--r--basctl/source/dlged/dlged.cxx12
-rw-r--r--basctl/source/dlged/dlgedfac.cxx8
-rw-r--r--basctl/source/dlged/dlgedobj.cxx73
5 files changed, 39 insertions, 95 deletions
diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx
index d09ec3029adc..5fe34036f3be 100644
--- a/basctl/source/basicide/baside3.cxx
+++ b/basctl/source/basicide/baside3.cxx
@@ -1167,9 +1167,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 0fb42445c113..19604dc27ea6 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
@@ -318,12 +315,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() )
@@ -354,12 +349,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() )
@@ -441,8 +434,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 )
@@ -469,8 +461,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 )
@@ -545,8 +536,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() )
@@ -596,8 +586,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() )
@@ -921,9 +910,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 af966403ff6b..a5f254257514 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 );
}
@@ -936,16 +934,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 7ddd166b9f50..c5aefca066d5 100644
--- a/basctl/source/dlged/dlgedfac.cxx
+++ b/basctl/source/dlged/dlgedfac.cxx
@@ -166,9 +166,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(...)
@@ -188,9 +186,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 ae73dbabeb67..33c7f8e2549d 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++;
}
}