summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2016-05-03 08:39:03 +0200
committerAshod Nakashian <ashod.nakashian@collabora.co.uk>2016-07-20 01:26:04 -0400
commita0e8e05008e143ee5e3bbc281d1c253c7e5ed136 (patch)
treeeaf5f70a067fd48704addd9f2b582624a2fb44ae /sw
parent9c7cae1561cfe16226b1f16dce59f08a38da3ce0 (diff)
use Any constructor instead of temporaries
(cherry picked from commit 58a32075ca4f457f570af75aef368dd6c389aca7) Change-Id: Iffb82a2cee1a28d89eeea2b905aaa14086ee475a
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/access/acccell.cxx12
-rw-r--r--sw/source/core/access/accnotextframe.cxx8
-rw-r--r--sw/source/core/swg/SwXMLTextBlocks1.cxx12
-rw-r--r--sw/source/core/unocore/swunohelper.cxx4
-rw-r--r--sw/source/filter/html/htmlform.cxx16
-rw-r--r--sw/source/filter/xml/wrtxml.cxx10
-rw-r--r--sw/source/filter/xml/xmlimp.cxx4
-rw-r--r--sw/source/filter/xml/xmlimpit.cxx4
-rw-r--r--sw/source/filter/xml/xmltexte.cxx21
-rw-r--r--sw/source/ui/dbui/addresslistdialog.cxx9
10 files changed, 27 insertions, 73 deletions
diff --git a/sw/source/core/access/acccell.cxx b/sw/source/core/access/acccell.cxx
index 64315c280bbc..ebe84f58255e 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 9b7a1bfdd7ee..c9d4ab844835 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 889be6a14534..6e361ac6bdf1 100644
--- a/sw/source/core/swg/SwXMLTextBlocks1.cxx
+++ b/sw/source/core/swg/SwXMLTextBlocks1.cxx
@@ -366,9 +366,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);
@@ -488,9 +486,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);
@@ -557,9 +553,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 04d0c4a56b3b..835c88bacdc3 100644
--- a/sw/source/filter/html/htmlform.cxx
+++ b/sw/source/filter/html/htmlform.cxx
@@ -2405,16 +2405,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 )
@@ -2430,10 +2425,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 0f5392f39b0c..f53e50ef5ab5 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 127726796d06..6afa81c25f48 100644
--- a/sw/source/filter/xml/xmlimp.cxx
+++ b/sw/source/filter/xml/xmlimp.cxx
@@ -1285,10 +1285,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 0e28509b7edd..afc8004e0035 100644
--- a/sw/source/filter/xml/xmlimpit.cxx
+++ b/sw/source/filter/xml/xmlimpit.cxx
@@ -661,9 +661,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 fdfabd949982..4dc0d55a5083 100644
--- a/sw/source/filter/xml/xmltexte.cxx
+++ b/sw/source/filter/xml/xmltexte.cxx
@@ -228,21 +228,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()) );
}
}
}
@@ -303,16 +298,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 b4d4cb537b1e..b58e48fc563a 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);