summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--basctl/source/basicide/basobj2.cxx4
-rw-r--r--comphelper/source/property/ChainablePropertySet.cxx16
-rw-r--r--comphelper/source/property/MasterPropertySet.cxx36
-rw-r--r--sc/source/ui/docshell/docfunc.cxx4
4 files changed, 30 insertions, 30 deletions
diff --git a/basctl/source/basicide/basobj2.cxx b/basctl/source/basicide/basobj2.cxx
index 28c1acdb383f..8a656bf08d7c 100644
--- a/basctl/source/basicide/basobj2.cxx
+++ b/basctl/source/basicide/basobj2.cxx
@@ -216,9 +216,9 @@ namespace
// in case this is a document-local macro, try to protect the document's Undo Manager from
// flawed scripts
- std::unique_ptr< ::framework::DocumentUndoGuard > pUndoGuard;
+ std::optional< ::framework::DocumentUndoGuard > pUndoGuard;
if ( pData->aDocument.isDocument() )
- pUndoGuard.reset( new ::framework::DocumentUndoGuard( pData->aDocument.getDocument() ) );
+ pUndoGuard.emplace( pData->aDocument.getDocument() );
RunMethod( pData->xMethod.get() );
}
diff --git a/comphelper/source/property/ChainablePropertySet.cxx b/comphelper/source/property/ChainablePropertySet.cxx
index 65a53e62479f..7c9caa17582a 100644
--- a/comphelper/source/property/ChainablePropertySet.cxx
+++ b/comphelper/source/property/ChainablePropertySet.cxx
@@ -51,9 +51,9 @@ Reference< XPropertySetInfo > SAL_CALL ChainablePropertySet::getPropertySetInfo(
void SAL_CALL ChainablePropertySet::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
{
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
- std::unique_ptr< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
+ std::optional< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
if (mpMutex)
- xMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) );
+ xMutexGuard.emplace( mpMutex );
PropertyInfoHash::const_iterator aIter = mxInfo->maMap.find ( rPropertyName );
@@ -68,9 +68,9 @@ void SAL_CALL ChainablePropertySet::setPropertyValue( const OUString& rPropertyN
Any SAL_CALL ChainablePropertySet::getPropertyValue( const OUString& rPropertyName )
{
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
- std::unique_ptr< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
+ std::optional< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
if (mpMutex)
- xMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) );
+ xMutexGuard.emplace( mpMutex );
PropertyInfoHash::const_iterator aIter = mxInfo->maMap.find ( rPropertyName );
@@ -109,9 +109,9 @@ void SAL_CALL ChainablePropertySet::removeVetoableChangeListener( const OUString
void SAL_CALL ChainablePropertySet::setPropertyValues(const Sequence< OUString >& rPropertyNames, const Sequence< Any >& rValues)
{
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
- std::unique_ptr< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
+ std::optional< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
if (mpMutex)
- xMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) );
+ xMutexGuard.emplace( mpMutex );
const sal_Int32 nCount = rPropertyNames.getLength();
@@ -142,9 +142,9 @@ void SAL_CALL ChainablePropertySet::setPropertyValues(const Sequence< OUString >
Sequence< Any > SAL_CALL ChainablePropertySet::getPropertyValues(const Sequence< OUString >& rPropertyNames)
{
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
- std::unique_ptr< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
+ std::optional< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
if (mpMutex)
- xMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) );
+ xMutexGuard.emplace( mpMutex );
const sal_Int32 nCount = rPropertyNames.getLength();
diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx
index 3f6f0119dbb6..51fdd4deb620 100644
--- a/comphelper/source/property/MasterPropertySet.cxx
+++ b/comphelper/source/property/MasterPropertySet.cxx
@@ -32,12 +32,12 @@ namespace {
class AutoOGuardArray
{
- std::vector<std::unique_ptr< osl::Guard< comphelper::SolarMutex > >> maGuardArray;
+ std::vector<std::optional< osl::Guard< comphelper::SolarMutex > >> maGuardArray;
public:
explicit AutoOGuardArray( sal_Int32 nNumElements );
- std::unique_ptr< osl::Guard< comphelper::SolarMutex > > & operator[] ( sal_Int32 i ) { return maGuardArray[i]; }
+ std::optional< osl::Guard< comphelper::SolarMutex > > & operator[] ( sal_Int32 i ) { return maGuardArray[i]; }
};
}
@@ -91,9 +91,9 @@ void MasterPropertySet::registerSlave ( ChainablePropertySet *pNewSet )
void SAL_CALL MasterPropertySet::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
{
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
- std::unique_ptr< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
+ std::optional< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
if (mpMutex)
- xMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) );
+ xMutexGuard.emplace( mpMutex );
PropertyDataHash::const_iterator aIter = mxInfo->maMap.find ( rPropertyName );
@@ -111,9 +111,9 @@ void SAL_CALL MasterPropertySet::setPropertyValue( const OUString& rPropertyName
ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mxSlave.get();
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
- std::unique_ptr< osl::Guard< comphelper::SolarMutex > > xMutexGuard2;
+ std::optional< osl::Guard< comphelper::SolarMutex > > xMutexGuard2;
if (pSlave->mpMutex)
- xMutexGuard2.reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mpMutex) );
+ xMutexGuard2.emplace( pSlave->mpMutex );
pSlave->_preSetValues();
pSlave->_setSingleValue( *((*aIter).second->mpInfo), rValue );
@@ -124,9 +124,9 @@ void SAL_CALL MasterPropertySet::setPropertyValue( const OUString& rPropertyName
Any SAL_CALL MasterPropertySet::getPropertyValue( const OUString& rPropertyName )
{
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
- std::unique_ptr< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
+ std::optional< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
if (mpMutex)
- xMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) );
+ xMutexGuard.emplace( mpMutex );
PropertyDataHash::const_iterator aIter = mxInfo->maMap.find ( rPropertyName );
@@ -145,9 +145,9 @@ Any SAL_CALL MasterPropertySet::getPropertyValue( const OUString& rPropertyName
ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mxSlave.get();
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
- std::unique_ptr< osl::Guard< comphelper::SolarMutex > > xMutexGuard2;
+ std::optional< osl::Guard< comphelper::SolarMutex > > xMutexGuard2;
if (pSlave->mpMutex)
- xMutexGuard2.reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mpMutex) );
+ xMutexGuard2.emplace( pSlave->mpMutex );
pSlave->_preGetValues();
pSlave->_getSingleValue( *((*aIter).second->mpInfo), aAny );
@@ -180,9 +180,9 @@ void SAL_CALL MasterPropertySet::removeVetoableChangeListener( const OUString&,
void SAL_CALL MasterPropertySet::setPropertyValues( const Sequence< OUString >& aPropertyNames, const Sequence< Any >& aValues )
{
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
- std::unique_ptr< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
+ std::optional< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
if (mpMutex)
- xMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) );
+ xMutexGuard.emplace( mpMutex );
const sal_Int32 nCount = aPropertyNames.getLength();
@@ -220,7 +220,7 @@ void SAL_CALL MasterPropertySet::setPropertyValues( const Sequence< OUString >&
{
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
if (pSlave->mxSlave->mpMutex)
- aOGuardArray[i].reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mxSlave->mpMutex) );
+ aOGuardArray[i].emplace( pSlave->mxSlave->mpMutex );
pSlave->mxSlave->_preSetValues();
pSlave->SetInit ( true );
@@ -243,9 +243,9 @@ void SAL_CALL MasterPropertySet::setPropertyValues( const Sequence< OUString >&
Sequence< Any > SAL_CALL MasterPropertySet::getPropertyValues( const Sequence< OUString >& aPropertyNames )
{
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
- std::unique_ptr< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
+ std::optional< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
if (mpMutex)
- xMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(mpMutex) );
+ xMutexGuard.emplace( mpMutex );
const sal_Int32 nCount = aPropertyNames.getLength();
@@ -281,7 +281,7 @@ Sequence< Any > SAL_CALL MasterPropertySet::getPropertyValues( const Sequence< O
{
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
if (pSlave->mxSlave->mpMutex)
- aOGuardArray[i].reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mxSlave->mpMutex) );
+ aOGuardArray[i].emplace( pSlave->mxSlave->mpMutex );
pSlave->mxSlave->_preGetValues();
pSlave->SetInit ( true );
@@ -331,9 +331,9 @@ PropertyState SAL_CALL MasterPropertySet::getPropertyState( const OUString& Prop
ChainablePropertySet * pSlave = maSlaveMap [ (*aIter).second->mnMapId ]->mxSlave.get();
// acquire mutex in c-tor and releases it in the d-tor (exception safe!).
- std::unique_ptr< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
+ std::optional< osl::Guard< comphelper::SolarMutex > > xMutexGuard;
if (pSlave->mpMutex)
- xMutexGuard.reset( new osl::Guard< comphelper::SolarMutex >(pSlave->mpMutex) );
+ xMutexGuard.emplace( pSlave->mpMutex );
}
return PropertyState_AMBIGUOUS_VALUE;
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 3e80b6ce5a6e..9c4d8848ffc7 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1248,9 +1248,9 @@ bool ScDocFunc::SetCellText(
{
ScDocument& rDoc = rDocShell.GetDocument();
- ::std::unique_ptr<ScExternalRefManager::ApiGuard> pExtRefGuard;
+ ::std::optional<ScExternalRefManager::ApiGuard> pExtRefGuard;
if (bApi)
- pExtRefGuard.reset(new ScExternalRefManager::ApiGuard(rDoc));
+ pExtRefGuard.emplace(rDoc);
ScInputStringType aRes =
ScStringUtil::parseInputString(*rDoc.GetFormatTable(), rText, LANGUAGE_ENGLISH_US);