[Libreoffice-commits] core.git: xmloff/source
Noel Grandin (via logerrit)
logerrit at kemper.freedesktop.org
Sat May 29 17:24:11 UTC 2021
xmloff/source/style/styleexp.cxx | 14 +++++++-------
xmloff/source/text/txtimp.cxx | 22 +++++++++++-----------
2 files changed, 18 insertions(+), 18 deletions(-)
New commits:
commit 397ba047c941eb7d77a15a8de72e20ace4744da1
Author: Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Fri May 28 15:19:09 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Sat May 29 19:23:31 2021 +0200
std::unique_ptr->std::optional
Change-Id: Ie01aec182ad361522f6ebc00e2f2e47d0fc38d33
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116378
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/xmloff/source/style/styleexp.cxx b/xmloff/source/style/styleexp.cxx
index 8b4256a3d043..159d5b50e02e 100644
--- a/xmloff/source/style/styleexp.cxx
+++ b/xmloff/source/style/styleexp.cxx
@@ -440,7 +440,7 @@ void XMLStyleExport::exportStyleFamily(
// If next styles are supported and used styles should be exported only,
// the next style may be unused but has to be exported, too. In this case
// the names of all exported styles are remembered.
- std::unique_ptr<std::set<OUString> > pExportedStyles;
+ std::optional<std::set<OUString> > xExportedStyles;
bool bFirstStyle = true;
const uno::Sequence< OUString> aSeq = xStyleCont->getElementNames();
@@ -478,14 +478,14 @@ void XMLStyleExport::exportStyleFamily(
xPropSet->getPropertySetInfo();
if (xPropSetInfo->hasPropertyByName( gsFollowStyle ))
- pExportedStyles.reset(new std::set<OUString>);
+ xExportedStyles.emplace();
bFirstStyle = false;
}
- if (pExportedStyles && bExported)
+ if (xExportedStyles && bExported)
{
// If next styles are supported, remember this style's name.
- pExportedStyles->insert( xStyle->getName() );
+ xExportedStyles->insert( xStyle->getName() );
}
}
@@ -495,7 +495,7 @@ void XMLStyleExport::exportStyleFamily(
pAutoStylePool->RegisterName( nFamily, xStyle->getName() );
}
- if( !pExportedStyles )
+ if( !xExportedStyles )
return;
// if next styles are supported, export all next styles that are
@@ -532,13 +532,13 @@ void XMLStyleExport::exportStyleFamily(
// if the next style hasn't been exported by now, export it now
// and remember its name.
if (xStyle->getName() != sNextName &&
- 0 == pExportedStyles->count( sTmp ))
+ 0 == xExportedStyles->count( sTmp ))
{
xStyleCont->getByName( sNextName ) >>= xStyle;
assert(xStyle.is());
if (exportStyle(xStyle, rXMLFamily, rPropMapper, xStyleCont, pPrefix))
- pExportedStyles->insert( sTmp );
+ xExportedStyles->insert( sTmp );
}
}
}
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index 4d521f295b95..90dc8dcc0c84 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -93,8 +93,8 @@ using namespace ::com::sun::star::ucb;
struct XMLTextImportHelper::Impl
{
- std::unique_ptr< std::vector<OUString> > m_xPrevFrmNames;
- std::unique_ptr< std::vector<OUString> > m_xNextFrmNames;
+ std::optional< std::vector<OUString> > m_xPrevFrmNames;
+ std::optional< std::vector<OUString> > m_xNextFrmNames;
std::unique_ptr<XMLTextListsHelper> m_xTextListsHelper;
rtl::Reference<SvXMLStylesContext> m_xAutoStyles;
@@ -172,7 +172,7 @@ struct XMLTextImportHelper::Impl
OUString m_sCellParaStyleDefault;
- std::unique_ptr<std::map<OUString, OUString>> m_pCrossRefHeadingBookmarkMap;
+ std::optional<std::map<OUString, OUString>> m_xCrossRefHeadingBookmarkMap;
Impl( uno::Reference<frame::XModel> const& rModel,
SvXMLImport & rImport,
@@ -2183,8 +2183,8 @@ void XMLTextImportHelper::ConnectFrameChains(
{
if (!m_xImpl->m_xPrevFrmNames)
{
- m_xImpl->m_xPrevFrmNames.reset( new std::vector<OUString> );
- m_xImpl->m_xNextFrmNames.reset( new std::vector<OUString> );
+ m_xImpl->m_xPrevFrmNames.emplace();
+ m_xImpl->m_xNextFrmNames.emplace();
}
m_xImpl->m_xPrevFrmNames->push_back(rFrmName);
m_xImpl->m_xNextFrmNames->push_back(sNextFrmName);
@@ -2372,11 +2372,11 @@ OUString const& XMLTextImportHelper::GetCellParaStyleDefault() const
void XMLTextImportHelper::AddCrossRefHeadingMapping(OUString const& rFrom, OUString const& rTo)
{
- if (!m_xImpl->m_pCrossRefHeadingBookmarkMap)
+ if (!m_xImpl->m_xCrossRefHeadingBookmarkMap)
{
- m_xImpl->m_pCrossRefHeadingBookmarkMap.reset(new std::map<OUString, OUString>);
+ m_xImpl->m_xCrossRefHeadingBookmarkMap.emplace();
}
- m_xImpl->m_pCrossRefHeadingBookmarkMap->insert(std::make_pair(rFrom, rTo));
+ m_xImpl->m_xCrossRefHeadingBookmarkMap->insert(std::make_pair(rFrom, rTo));
}
// tdf#94804: hack to map cross reference fields that reference duplicate marks
@@ -2384,7 +2384,7 @@ void XMLTextImportHelper::AddCrossRefHeadingMapping(OUString const& rFrom, OUStr
// be round-tripped by different versions preserving duplicates => always map
void XMLTextImportHelper::MapCrossRefHeadingFieldsHorribly()
{
- if (!m_xImpl->m_pCrossRefHeadingBookmarkMap)
+ if (!m_xImpl->m_xCrossRefHeadingBookmarkMap)
{
return;
}
@@ -2417,8 +2417,8 @@ void XMLTextImportHelper::MapCrossRefHeadingFieldsHorribly()
}
OUString name;
xField->getPropertyValue("SourceName") >>= name;
- auto const iter(m_xImpl->m_pCrossRefHeadingBookmarkMap->find(name));
- if (iter == m_xImpl->m_pCrossRefHeadingBookmarkMap->end())
+ auto const iter(m_xImpl->m_xCrossRefHeadingBookmarkMap->find(name));
+ if (iter == m_xImpl->m_xCrossRefHeadingBookmarkMap->end())
{
continue;
}
More information about the Libreoffice-commits
mailing list