diff options
author | Noel Grandin <noel@peralex.com> | 2016-05-03 08:39:03 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2016-05-04 12:39:40 +0200 |
commit | 58a32075ca4f457f570af75aef368dd6c389aca7 (patch) | |
tree | e437dcbdeb248b4316cb8a9281d1543419853f6d /sw | |
parent | 7d47700972d267fe7c5270c5dadd45a523a2baec (diff) |
use Any constructor instead of temporaries
Change-Id: Iffb82a2cee1a28d89eeea2b905aaa14086ee475a
Diffstat (limited to 'sw')
-rw-r--r-- | sw/source/core/access/acccell.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/access/accnotextframe.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/swg/SwXMLTextBlocks1.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/unocore/swunohelper.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/html/htmlform.cxx | 16 | ||||
-rw-r--r-- | sw/source/filter/xml/wrtxml.cxx | 10 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimp.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/xml/xmlimpit.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/xml/xmltexte.cxx | 21 | ||||
-rw-r--r-- | sw/source/ui/dbui/addresslistdialog.cxx | 9 |
10 files changed, 27 insertions, 73 deletions
diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx index bf2a6fd3a2ab..d448a7f281b7 100644 --- a/sw/source/core/access/acccell.cxx +++ b/sw/source/core/access/acccell.cxx @@ -353,9 +353,7 @@ uno::Any SwAccessibleCell::getCurrentValue( ) SolarMutexGuard aGuard; CHECK_FOR_DEFUNC( XAccessibleValue ); - uno::Any aAny; - aAny <<= GetTableBoxFormat()->GetTableBoxValue().GetValue(); - return aAny; + return uno::Any( GetTableBoxFormat()->GetTableBoxValue().GetValue() ); } sal_Bool SwAccessibleCell::setCurrentValue( const uno::Any& aNumber ) @@ -377,17 +375,13 @@ sal_Bool SwAccessibleCell::setCurrentValue( const uno::Any& aNumber ) uno::Any SwAccessibleCell::getMaximumValue( ) throw( uno::RuntimeException, std::exception ) { - uno::Any aAny; - aAny <<= DBL_MAX; - return aAny; + return uno::Any(DBL_MAX); } uno::Any SwAccessibleCell::getMinimumValue( ) throw( uno::RuntimeException, std::exception ) { - uno::Any aAny; - aAny <<= -DBL_MAX; - return aAny; + return uno::Any(-DBL_MAX); } static OUString ReplaceOneChar(const OUString& oldOUString, const OUString& replacedChar, const OUString& replaceStr) diff --git a/sw/source/core/access/accnotextframe.cxx b/sw/source/core/access/accnotextframe.cxx index 1fd4bc7be5f8..3fba776b7202 100644 --- a/sw/source/core/access/accnotextframe.cxx +++ b/sw/source/core/access/accnotextframe.cxx @@ -209,16 +209,12 @@ uno::Any SAL_CALL SwAccessibleNoTextFrame::queryInterface( const uno::Type& aTyp ::cppu::UnoType<XAccessibleImage>::get() ) { uno::Reference<XAccessibleImage> xImage = this; - uno::Any aAny; - aAny <<= xImage; - return aAny; + return uno::Any(xImage); } else if ( aType == cppu::UnoType<XAccessibleHypertext>::get()) { uno::Reference<XAccessibleHypertext> aAccHypertext = this; - uno::Any aAny; - aAny <<= aAccHypertext; - return aAny; + return uno::Any( aAccHypertext ); } else return SwAccessibleContext::queryInterface( aType ); diff --git a/sw/source/core/swg/SwXMLTextBlocks1.cxx b/sw/source/core/swg/SwXMLTextBlocks1.cxx index 1d76da96cc27..b2f50acf46fb 100644 --- a/sw/source/core/swg/SwXMLTextBlocks1.cxx +++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx @@ -361,9 +361,7 @@ sal_uLong SwXMLTextBlocks::PutBlockText( const OUString& rShort, const OUString& uno::Reference < beans::XPropertySet > xSet( xDocStream, uno::UNO_QUERY ); OUString aMime ( "text/xml" ); - Any aAny; - aAny <<= aMime; - xSet->setPropertyValue("MediaType", aAny ); + xSet->setPropertyValue("MediaType", Any(aMime) ); uno::Reference < io::XOutputStream > xOut = xDocStream->getOutputStream(); uno::Reference<io::XActiveDataSource> xSrc(xWriter, uno::UNO_QUERY); xSrc->setOutputStream(xOut); @@ -483,9 +481,7 @@ void SwXMLTextBlocks::WriteInfo() uno::Reference < beans::XPropertySet > xSet( xDocStream, uno::UNO_QUERY ); OUString aMime ( "text/xml" ); - Any aAny; - aAny <<= aMime; - xSet->setPropertyValue("MediaType", aAny ); + xSet->setPropertyValue("MediaType", Any(aMime) ); uno::Reference < io::XOutputStream > xOut = xDocStream->getOutputStream(); uno::Reference<io::XActiveDataSource> xSrc(xWriter, uno::UNO_QUERY); xSrc->setOutputStream(xOut); @@ -548,9 +544,7 @@ sal_uLong SwXMLTextBlocks::SetMacroTable( uno::Reference < beans::XPropertySet > xSet( xDocStream, uno::UNO_QUERY ); OUString aMime( "text/xml" ); - Any aAny; - aAny <<= aMime; - xSet->setPropertyValue("MediaType", aAny ); + xSet->setPropertyValue("MediaType", Any(aMime) ); uno::Reference < io::XOutputStream > xOutputStream = xDocStream->getOutputStream(); // get XML writer diff --git a/sw/source/core/unocore/swunohelper.cxx b/sw/source/core/unocore/swunohelper.cxx index 1a7e50bcdd09..8dd8028d4a24 100644 --- a/sw/source/core/unocore/swunohelper.cxx +++ b/sw/source/core/unocore/swunohelper.cxx @@ -96,14 +96,12 @@ bool UCB_CopyFile( const OUString& rURL, const OUString& rNewURL, bool bCopyIsMo css::uno::Reference< css::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() ); - css::uno::Any aAny; css::ucb::TransferInfo aInfo; aInfo.NameClash = css::ucb::NameClash::ERROR; aInfo.NewTitle = sName; aInfo.SourceURL = rURL; aInfo.MoveData = bCopyIsMove; - aAny <<= aInfo; - aTempContent.executeCommand( "transfer", aAny ); + aTempContent.executeCommand( "transfer", uno::Any(aInfo) ); } catch( css::uno::Exception& ) { diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index f66a46901f09..13fb7a76cd94 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -2404,16 +2404,11 @@ void SwHTMLParser::EndSelect() pValues[i] = sText; } - Any aAny( &aList, cppu::UnoType<uno::Sequence<OUString>>::get() ); + rPropSet->setPropertyValue("StringItemList", Any(aList) ); - rPropSet->setPropertyValue("StringItemList", aAny ); + rPropSet->setPropertyValue("ListSourceType", Any(ListSourceType_VALUELIST) ); - aAny <<= ListSourceType_VALUELIST; - rPropSet->setPropertyValue("ListSourceType", aAny ); - - aAny.setValue( &aValueList, cppu::UnoType<uno::Sequence<OUString>>::get() ); - - rPropSet->setPropertyValue("ListSource", aAny ); + rPropSet->setPropertyValue("ListSource", Any(aValueList) ); size_t nSelCnt = m_pFormImpl->GetSelectedList().size(); if( !nSelCnt && 1 == m_nSelectEntryCnt && nEntryCnt ) @@ -2429,10 +2424,7 @@ void SwHTMLParser::EndSelect() { pSels[i] = (sal_Int16)m_pFormImpl->GetSelectedList()[i]; } - aAny.setValue( &aSelList, - cppu::UnoType<uno::Sequence<sal_Int16>>::get() ); - - rPropSet->setPropertyValue("DefaultSelection", aAny ); + rPropSet->setPropertyValue("DefaultSelection", Any(aSelList) ); m_pFormImpl->EraseStringList(); m_pFormImpl->EraseValueList(); diff --git a/sw/source/filter/xml/wrtxml.cxx b/sw/source/filter/xml/wrtxml.cxx index 6967c98860a6..2fbdd81aabdc 100644 --- a/sw/source/filter/xml/wrtxml.cxx +++ b/sw/source/filter/xml/wrtxml.cxx @@ -170,11 +170,9 @@ sal_uInt32 SwXMLWriter::Write_( const uno::Reference < task::XStatusIndicator >& xStatusIndicator->start(SW_RESSTR( STR_STATSTR_SWGWRITE), nProgressRange); } - aAny <<= nProgressRange; - xInfoSet->setPropertyValue("ProgressRange", aAny); + xInfoSet->setPropertyValue("ProgressRange", Any(nProgressRange)); - aAny <<= static_cast < sal_Int32 >( -1 ); - xInfoSet->setPropertyValue("ProgressMax", aAny); + xInfoSet->setPropertyValue("ProgressMax", Any(static_cast < sal_Int32 >( -1 ))); } SvtSaveOptions aSaveOpt; @@ -486,9 +484,7 @@ bool SwXMLWriter::WriteThroughComponent( if( !xSet.is() ) return false; - uno::Any aAny; - aAny <<= OUString("text/xml"); - xSet->setPropertyValue("MediaType", aAny ); + xSet->setPropertyValue("MediaType", Any(OUString("text/xml")) ); // even plain stream should be encrypted in encrypted documents xSet->setPropertyValue( "UseCommonStoragePasswordEncryption", makeAny(true) ); diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 12c1e246b4d5..e749b3a3d2c2 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -1283,10 +1283,8 @@ void SwXMLImport::SetConfigurationSettings(const Sequence < PropertyValue > & aC if( ! bPrinterIndependentLayout ) { - Any aAny; sal_Int16 nTmp = document::PrinterIndependentLayout::DISABLED; - aAny <<= nTmp; - xProps->setPropertyValue( "PrinterIndependentLayout", aAny ); + xProps->setPropertyValue( "PrinterIndependentLayout", Any(nTmp) ); } if( ! bAddExternalLeading ) diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx index ea475c3e1d87..ed7fb7c295a5 100644 --- a/sw/source/filter/xml/xmlimpit.cxx +++ b/sw/source/filter/xml/xmlimpit.cxx @@ -663,9 +663,7 @@ bool SvXMLImportItemMapper::PutXMLValue( case MID_GRAPHIC_LINK: { SvxGraphicPosition eOldGraphicPos = rBrush.GetGraphicPos(); - uno::Any aAny; - aAny <<= rValue; - rBrush.PutValue( aAny, MID_GRAPHIC_URL ); + rBrush.PutValue( Any(rValue), MID_GRAPHIC_URL ); if( GPOS_NONE == eOldGraphicPos && GPOS_NONE != rBrush.GetGraphicPos() ) rBrush.SetGraphicPos( GPOS_TILED ); diff --git a/sw/source/filter/xml/xmltexte.cxx b/sw/source/filter/xml/xmltexte.cxx index 2ce19b9a639f..5dcfedb3a21c 100644 --- a/sw/source/filter/xml/xmltexte.cxx +++ b/sw/source/filter/xml/xmltexte.cxx @@ -224,21 +224,16 @@ static void lcl_addOutplaceProperties( if( aSize.Width() && aSize.Height() ) { - Any aAny; - aAny <<= 0L; - *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_LEFT ), aAny ); + *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_LEFT ), Any(0L) ); pStates++; - aAny <<= 0L; - *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_TOP ), aAny ); + *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_TOP ), Any(0L) ); pStates++; - aAny <<= (sal_Int32)aSize.Width(); - *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_WIDTH ), aAny ); + *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_WIDTH ), Any((sal_Int32)aSize.Width()) ); pStates++; - aAny <<= (sal_Int32)aSize.Height(); - *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_HEIGHT ), aAny ); + *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_OLE_VIS_AREA_HEIGHT ), Any((sal_Int32)aSize.Height()) ); } } } @@ -299,16 +294,12 @@ static void lcl_addFrameProperties( } if( SIZE_NOT_SET != nWidth ) { - Any aAny2; - aAny <<= nWidth; - *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_FRAME_MARGIN_HORI ), aAny2 ); + *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_FRAME_MARGIN_HORI ), Any(nWidth) ); pStates++; } if( SIZE_NOT_SET != nHeight ) { - Any aAny2; - aAny <<= nHeight; - *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_FRAME_MARGIN_VERT ), aAny2 ); + *pStates = new XMLPropertyState( rMapper->FindEntryIndex( CTF_FRAME_MARGIN_VERT ), Any(nHeight) ); } } diff --git a/sw/source/ui/dbui/addresslistdialog.cxx b/sw/source/ui/dbui/addresslistdialog.cxx index ad7797d877af..bef855f4010e 100644 --- a/sw/source/ui/dbui/addresslistdialog.cxx +++ b/sw/source/ui/dbui/addresslistdialog.cxx @@ -386,12 +386,10 @@ IMPL_LINK_TYPED(SwAddressListDialog, CreateHdl_Impl, Button*, pButton, void) aTempURL.removeSegment(); aTempURL.removeFinalSlash(); const OUString sDBURL("sdbc:flat:" + aTempURL.GetMainURL(INetURLObject::NO_DECODE)); - Any aAny(&sDBURL, cppu::UnoType<decltype(sDBURL)>::get()); - xDataProperties->setPropertyValue("URL", aAny); + xDataProperties->setPropertyValue("URL", Any(sDBURL)); //set the filter to the file name without extension uno::Sequence<OUString> aFilters { sNewName }; - aAny <<= aFilters; - xDataProperties->setPropertyValue("TableFilter", aAny); + xDataProperties->setPropertyValue("TableFilter", Any(aFilters)); uno::Sequence<PropertyValue> aInfo(4); PropertyValue* pInfo = aInfo.getArray(); @@ -403,8 +401,7 @@ IMPL_LINK_TYPED(SwAddressListDialog, CreateHdl_Impl, Button*, pButton, void) pInfo[2].Value <<= aURL.getExtension();//"csv"; pInfo[3].Name = "CharSet"; pInfo[3].Value <<= OUString("UTF-8"); - aAny <<= aInfo; - xDataProperties->setPropertyValue("Info", aAny); + xDataProperties->setPropertyValue("Info", Any(aInfo)); uno::Reference<sdb::XDocumentDataSource> xDS(xNewInstance, UNO_QUERY_THROW); uno::Reference<frame::XStorable> xStore(xDS->getDatabaseDocument(), UNO_QUERY_THROW); |