summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-05-28 15:35:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-29 19:23:44 +0200
commit66438a0ad5a3c6d2792f4c6c04c2d2405b5679cb (patch)
tree29eb826ce08a4e4f691b8306d9af968396e7b56c /sw
parent397ba047c941eb7d77a15a8de72e20ace4744da1 (diff)
std::unique_ptr->std::optional
Change-Id: Ie09ede2ce21c206ca158a5a89d50143cdde45e3e Reviewed-on: https://gerrit.libreoffice.org/c/core/+/116381 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/undobj.hxx6
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx4
-rw-r--r--sw/source/core/undo/untblk.cxx6
-rw-r--r--sw/source/core/unocore/unostyle.cxx20
-rw-r--r--sw/source/filter/html/htmlftn.cxx16
-rw-r--r--sw/source/filter/html/htmltab.cxx54
-rw-r--r--sw/source/filter/html/wrthtml.cxx6
-rw-r--r--sw/source/filter/html/wrthtml.hxx2
-rw-r--r--sw/source/filter/writer/writer.cxx12
9 files changed, 63 insertions, 63 deletions
diff --git a/sw/inc/undobj.hxx b/sw/inc/undobj.hxx
index 4eae5cddaf3f..d48db259c77d 100644
--- a/sw/inc/undobj.hxx
+++ b/sw/inc/undobj.hxx
@@ -243,7 +243,7 @@ class SwUndoInsLayFormat;
namespace sw {
-std::unique_ptr<std::vector<SwFrameFormat*>>
+std::optional<std::vector<SwFrameFormat*>>
GetFlysAnchoredAt(SwDoc & rDoc, sal_uLong nSttNode);
}
@@ -252,7 +252,7 @@ GetFlysAnchoredAt(SwDoc & rDoc, sal_uLong nSttNode);
class SwUndoInserts : public SwUndo, public SwUndRng, private SwUndoSaveContent
{
SwTextFormatColl *m_pTextFormatColl, *m_pLastNodeColl;
- std::unique_ptr<std::vector<SwFrameFormat*>> m_pFrameFormats;
+ std::optional<std::vector<SwFrameFormat*>> m_pFrameFormats;
std::vector< std::shared_ptr<SwUndoInsLayFormat> > m_FlyUndos;
std::unique_ptr<SwRedlineData> m_pRedlineData;
int m_nDeleteTextNodes;
@@ -277,7 +277,7 @@ public:
static bool IsCreateUndoForNewFly(SwFormatAnchor const& rAnchor,
sal_uLong const nStartNode, sal_uLong const nEndNode);
- std::vector<SwFrameFormat*> * GetFlysAnchoredAt() { return m_pFrameFormats.get(); }
+ std::vector<SwFrameFormat*> * GetFlysAnchoredAt() { return m_pFrameFormats ? &*m_pFrameFormats : nullptr; }
void dumpAsXml(xmlTextWriterPtr pWriter) const override;
};
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index 254d0fc00085..c5313a093470 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -4732,7 +4732,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
std::shared_ptr<SwUnoCursor> const pCopyPam(rDoc.CreateUnoCursor(rPos));
SwTableNumFormatMerge aTNFM( m_rDoc, rDoc );
- std::unique_ptr<std::vector<SwFrameFormat*>> pFlys;
+ std::optional<std::vector<SwFrameFormat*>> pFlys;
std::vector<SwFrameFormat*> const* pFlysAtInsPos;
if (rDoc.GetIDocumentUndoRedo().DoesUndo())
@@ -4743,7 +4743,7 @@ bool DocumentContentOperationsManager::CopyImplImpl(SwPaM& rPam, SwPosition& rPo
else
{
pFlys = sw::GetFlysAnchoredAt(rDoc, rPos.nNode.GetIndex());
- pFlysAtInsPos = pFlys.get();
+ pFlysAtInsPos = pFlys ? &*pFlys : nullptr;
}
RedlineFlags eOld = rDoc.getIDocumentRedlineAccess().GetRedlineFlags();
diff --git a/sw/source/core/undo/untblk.cxx b/sw/source/core/undo/untblk.cxx
index 5fd92fe63eca..fc30657333b9 100644
--- a/sw/source/core/undo/untblk.cxx
+++ b/sw/source/core/undo/untblk.cxx
@@ -36,10 +36,10 @@
namespace sw {
-std::unique_ptr<std::vector<SwFrameFormat*>>
+std::optional<std::vector<SwFrameFormat*>>
GetFlysAnchoredAt(SwDoc & rDoc, sal_uLong const nSttNode)
{
- std::unique_ptr<std::vector<SwFrameFormat*>> pFrameFormats;
+ std::optional<std::vector<SwFrameFormat*>> pFrameFormats;
const size_t nArrLen = rDoc.GetSpzFrameFormats()->size();
for (size_t n = 0; n < nArrLen; ++n)
{
@@ -52,7 +52,7 @@ GetFlysAnchoredAt(SwDoc & rDoc, sal_uLong const nSttNode)
|| (pAnchor->GetAnchorId() == RndStdIds::FLY_AT_CHAR)))
{
if (!pFrameFormats)
- pFrameFormats.reset( new std::vector<SwFrameFormat*> );
+ pFrameFormats.emplace();
pFrameFormats->push_back( pFormat );
}
}
diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx
index 6633906e5346..ac72abefd161 100644
--- a/sw/source/core/unocore/unostyle.cxx
+++ b/sw/source/core/unocore/unostyle.cxx
@@ -1899,10 +1899,10 @@ void SwXStyle::SetPropertyValue<FN_UNO_CATEGORY>(const SfxItemPropertyMapEntry&,
{
if(!o_rStyleBase.getNewBase()->IsUserDefined() || !rValue.has<paragraphstyle_t>())
throw lang::IllegalArgumentException();
- static std::unique_ptr<std::map<paragraphstyle_t, SfxStyleSearchBits>> pUnoToCore;
+ static std::optional<std::map<paragraphstyle_t, SfxStyleSearchBits>> pUnoToCore;
if(!pUnoToCore)
{
- pUnoToCore.reset(new std::map<paragraphstyle_t, SfxStyleSearchBits>);
+ pUnoToCore.emplace();
auto pEntries = lcl_GetParagraphStyleCategoryEntries();
std::transform(pEntries->begin(), pEntries->end(), std::inserter(*pUnoToCore, pUnoToCore->end()),
[] (const ParagraphStyleCategoryEntry& rEntry) { return std::pair<paragraphstyle_t, SfxStyleSearchBits>(rEntry.m_eCategory, rEntry.m_nSwStyleBits); });
@@ -2003,10 +2003,10 @@ void SwXStyle::SetStyleProperty(const SfxItemPropertyMapEntry& rEntry, const Sfx
{
using propertytype_t = decltype(rEntry.nWID);
using coresetter_t = std::function<void(SwXStyle&, const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, const uno::Any&, SwStyleBase_Impl&)>;
- static std::unique_ptr<std::map<propertytype_t, coresetter_t>> pUnoToCore;
+ static std::optional<std::map<propertytype_t, coresetter_t>> pUnoToCore;
if(!pUnoToCore)
{
- pUnoToCore.reset(new std::map<propertytype_t, coresetter_t> {
+ pUnoToCore = std::map<propertytype_t, coresetter_t> {
// these explicit std::mem_fn() calls shouldn't be needed, but apparently MSVC is currently too stupid for C++11 again
{ FN_UNO_HIDDEN, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_HIDDEN>) },
{ FN_UNO_STYLE_INTEROP_GRAB_BAG, std::mem_fn(&SwXStyle::SetPropertyValue<FN_UNO_STYLE_INTEROP_GRAB_BAG>) },
@@ -2029,7 +2029,7 @@ void SwXStyle::SetStyleProperty(const SfxItemPropertyMapEntry& rEntry, const Sfx
{ RES_TXTATR_CJK_RUBY, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(RES_TXTATR_CJK_RUBY)>) },
{ RES_PARATR_DROP, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_DROP)>) },
{ RES_PARATR_NUMRULE, std::mem_fn(&SwXStyle::SetPropertyValue<sal_uInt16(RES_PARATR_NUMRULE)>) }
- });
+ };
}
const auto pUnoToCoreIt(pUnoToCore->find(rEntry.nWID));
if(pUnoToCoreIt != pUnoToCore->end())
@@ -2262,10 +2262,10 @@ template<>
uno::Any SwXStyle::GetStyleProperty<FN_UNO_CATEGORY>(const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl& rBase)
{
PrepareStyleBase(rBase);
- static std::unique_ptr<std::map<collectionbits_t, paragraphstyle_t>> pUnoToCore;
+ static std::optional<std::map<collectionbits_t, paragraphstyle_t>> pUnoToCore;
if(!pUnoToCore)
{
- pUnoToCore.reset(new std::map<collectionbits_t, paragraphstyle_t>);
+ pUnoToCore.emplace();
auto pEntries = lcl_GetParagraphStyleCategoryEntries();
std::transform(pEntries->begin(), pEntries->end(), std::inserter(*pUnoToCore, pUnoToCore->end()),
[] (const ParagraphStyleCategoryEntry& rEntry) { return std::pair<collectionbits_t, paragraphstyle_t>(rEntry.m_nCollectionBits, rEntry.m_eCategory); });
@@ -2343,10 +2343,10 @@ uno::Any SwXStyle::GetStyleProperty_Impl(const SfxItemPropertyMapEntry& rEntry,
{
using propertytype_t = decltype(rEntry.nWID);
using coresetter_t = std::function<uno::Any(SwXStyle&, const SfxItemPropertyMapEntry&, const SfxItemPropertySet&, SwStyleBase_Impl&)>;
- static std::unique_ptr<std::map<propertytype_t, coresetter_t>> pUnoToCore;
+ static std::optional<std::map<propertytype_t, coresetter_t>> pUnoToCore;
if(!pUnoToCore)
{
- pUnoToCore.reset(new std::map<propertytype_t, coresetter_t> {
+ pUnoToCore = std::map<propertytype_t, coresetter_t> {
// these explicit std::mem_fn() calls shouldn't be needed, but apparently MSVC is currently too stupid for C++11 again
{ FN_UNO_IS_PHYSICAL, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_IS_PHYSICAL>) },
{ FN_UNO_HIDDEN, std::mem_fn(&SwXStyle::GetStyleProperty<FN_UNO_HIDDEN>) },
@@ -2363,7 +2363,7 @@ uno::Any SwXStyle::GetStyleProperty_Impl(const SfxItemPropertyMapEntry& rEntry,
{ SID_SWREGISTER_COLLECTION, std::mem_fn(&SwXStyle::GetStyleProperty<SID_SWREGISTER_COLLECTION>) },
{ RES_BACKGROUND, std::mem_fn(&SwXStyle::GetStyleProperty<sal_uInt16(RES_BACKGROUND)>) },
{ OWN_ATTR_FILLBMP_MODE, std::mem_fn(&SwXStyle::GetStyleProperty<OWN_ATTR_FILLBMP_MODE>) }
- });
+ };
}
const auto pUnoToCoreIt(pUnoToCore->find(rEntry.nWID));
if(pUnoToCoreIt != pUnoToCore->end())
diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx
index ebd80a589d07..a39545631e90 100644
--- a/sw/source/filter/html/htmlftn.cxx
+++ b/sw/source/filter/html/htmlftn.cxx
@@ -253,7 +253,7 @@ Writer& OutHTML_SwFormatFootnote( Writer& rWrt, const SfxPoolItem& rHt )
size_t nPos;
if( rFormatFootnote.IsEndNote() )
{
- nPos = rHTMLWrt.m_pFootEndNotes ? rHTMLWrt.m_pFootEndNotes->size() : 0;
+ nPos = rHTMLWrt.m_xFootEndNotes ? rHTMLWrt.m_xFootEndNotes->size() : 0;
OSL_ENSURE( nPos == static_cast<size_t>(rHTMLWrt.m_nFootNote + rHTMLWrt.m_nEndNote),
"OutHTML_SwFormatFootnote: wrong position" );
sClass = OOO_STRING_SVTOOLS_HTML_sdendnote_anc;
@@ -266,9 +266,9 @@ Writer& OutHTML_SwFormatFootnote( Writer& rWrt, const SfxPoolItem& rHt )
sFootnoteName = OOO_STRING_SVTOOLS_HTML_sdfootnote + OUString::number( static_cast<sal_Int32>(++rHTMLWrt.m_nFootNote));
}
- if( !rHTMLWrt.m_pFootEndNotes )
- rHTMLWrt.m_pFootEndNotes.reset(new std::vector<SwTextFootnote*>);
- rHTMLWrt.m_pFootEndNotes->insert( rHTMLWrt.m_pFootEndNotes->begin() + nPos, pTextFootnote );
+ if( !rHTMLWrt.m_xFootEndNotes )
+ rHTMLWrt.m_xFootEndNotes.emplace();
+ rHTMLWrt.m_xFootEndNotes->insert( rHTMLWrt.m_xFootEndNotes->begin() + nPos, pTextFootnote );
OStringBuffer sOut;
OString aTag = rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_anchor;
@@ -299,9 +299,9 @@ Writer& OutHTML_SwFormatFootnote( Writer& rWrt, const SfxPoolItem& rHt )
void SwHTMLWriter::OutFootEndNotes()
{
- OSL_ENSURE( m_pFootEndNotes,
+ OSL_ENSURE( m_xFootEndNotes,
"SwHTMLWriter::OutFootEndNotes(): unnecessary call" );
- if( !m_pFootEndNotes )
+ if( !m_xFootEndNotes )
return;
#if OSL_DEBUG_LEVEL > 0
@@ -310,7 +310,7 @@ void SwHTMLWriter::OutFootEndNotes()
m_nFootNote = 0;
m_nEndNote = 0;
- for( auto *pTextFootnote : *m_pFootEndNotes )
+ for( auto *pTextFootnote : *m_xFootEndNotes )
{
m_pFormatFootnote = &pTextFootnote->GetFootnote();
@@ -373,7 +373,7 @@ void SwHTMLWriter::OutFootEndNotes()
"SwHTMLWriter::OutFootEndNotes: Number of endnotes does not match" );
#endif
- m_pFootEndNotes.reset();
+ m_xFootEndNotes.reset();
m_nFootNote = m_nEndNote = 0;
}
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 8969248fee90..7113c8fa9313 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -386,8 +386,8 @@ class HTMLTable
OUString m_aClass;
OUString m_aDir;
- std::unique_ptr<SdrObjects> m_pResizeDrawObjects;// SDR objects
- std::unique_ptr<std::vector<sal_uInt16>> m_pDrawObjectPercentWidths; // column of draw object and its rel. width
+ std::optional<SdrObjects> m_xResizeDrawObjects;// SDR objects
+ std::optional<std::vector<sal_uInt16>> m_xDrawObjectPercentWidths; // column of draw object and its rel. width
std::vector<HTMLTableRow> m_aRows; ///< table rows
std::vector<HTMLTableColumn> m_aColumns; ///< table columns
@@ -1074,8 +1074,8 @@ HTMLTable::~HTMLTable()
{
m_pParser->DeregisterHTMLTable(this);
- m_pResizeDrawObjects.reset();
- m_pDrawObjectPercentWidths.reset();
+ m_xResizeDrawObjects.reset();
+ m_xDrawObjectPercentWidths.reset();
m_pContext.reset();
@@ -2433,16 +2433,16 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
const_cast<SwTable *>(m_pSwTable)->SetHTMLTableLayout(m_xLayoutInfo);
- if( !m_pResizeDrawObjects )
+ if( !m_xResizeDrawObjects )
return;
- sal_uInt16 nCount = m_pResizeDrawObjects->size();
+ sal_uInt16 nCount = m_xResizeDrawObjects->size();
for( sal_uInt16 i=0; i<nCount; i++ )
{
- SdrObject *pObj = (*m_pResizeDrawObjects)[i];
- sal_uInt16 nRow = (*m_pDrawObjectPercentWidths)[3*i];
- sal_uInt16 nCol = (*m_pDrawObjectPercentWidths)[3*i+1];
- sal_uInt8 nPercentWidth = static_cast<sal_uInt8>((*m_pDrawObjectPercentWidths)[3*i+2]);
+ SdrObject *pObj = (*m_xResizeDrawObjects)[i];
+ sal_uInt16 nRow = (*m_xDrawObjectPercentWidths)[3*i];
+ sal_uInt16 nCol = (*m_xDrawObjectPercentWidths)[3*i+1];
+ sal_uInt8 nPercentWidth = static_cast<sal_uInt8>((*m_xDrawObjectPercentWidths)[3*i+2]);
SwHTMLTableLayoutCell *pLayoutCell =
m_xLayoutInfo->GetCell( nRow, nCol );
@@ -2473,15 +2473,15 @@ void HTMLTable::SetTable( const SwStartNode *pStNd, std::unique_ptr<HTMLTableCon
void HTMLTable::RegisterDrawObject( SdrObject *pObj, sal_uInt8 nPercentWidth )
{
- if( !m_pResizeDrawObjects )
- m_pResizeDrawObjects.reset(new SdrObjects);
- m_pResizeDrawObjects->push_back( pObj );
-
- if( !m_pDrawObjectPercentWidths )
- m_pDrawObjectPercentWidths.reset(new std::vector<sal_uInt16>);
- m_pDrawObjectPercentWidths->push_back( m_nCurrentRow );
- m_pDrawObjectPercentWidths->push_back( m_nCurrentColumn );
- m_pDrawObjectPercentWidths->push_back( o3tl::narrowing<sal_uInt16>(nPercentWidth) );
+ if( !m_xResizeDrawObjects )
+ m_xResizeDrawObjects.emplace();
+ m_xResizeDrawObjects->push_back( pObj );
+
+ if( !m_xDrawObjectPercentWidths )
+ m_xDrawObjectPercentWidths.emplace();
+ m_xDrawObjectPercentWidths->push_back( m_nCurrentRow );
+ m_xDrawObjectPercentWidths->push_back( m_nCurrentColumn );
+ m_xDrawObjectPercentWidths->push_back( o3tl::narrowing<sal_uInt16>(nPercentWidth) );
}
void HTMLTable::MakeParentContents()
@@ -3358,7 +3358,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
m_nContextStAttrMin ) );
// end all open attributes and open them again behind the table
- std::unique_ptr<std::deque<std::unique_ptr<HTMLAttr>>> pPostIts;
+ std::optional<std::deque<std::unique_ptr<HTMLAttr>>> pPostIts;
if( !bForceFrame && (bTopTable || pCurTable->HasParentSection()) )
{
SplitAttrTab(pTCntxt->xAttrTab, bTopTable);
@@ -3370,16 +3370,16 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
if( (bTopTable && !bAppended) ||
(!bTopTable && !bParentLFStripped &&
!m_pPam->GetPoint()->nContent.GetIndex()) )
- pPostIts.reset(new std::deque<std::unique_ptr<HTMLAttr>>);
- SetAttr( bTopTable, bTopTable, pPostIts.get() );
+ pPostIts.emplace();
+ SetAttr( bTopTable, bTopTable, &*pPostIts );
}
else
{
SaveAttrTab(pTCntxt->xAttrTab);
if( bTopTable && !bAppended )
{
- pPostIts.reset(new std::deque<std::unique_ptr<HTMLAttr>>);
- SetAttr( true, true, pPostIts.get() );
+ pPostIts.emplace();
+ SetAttr( true, true, &*pPostIts );
}
}
m_bNoParSpace = false;
@@ -5234,15 +5234,15 @@ std::shared_ptr<HTMLTable> SwHTMLParser::BuildTable(SvxAdjust eParentAdjust,
bool HTMLTable::PendingDrawObjectsInPaM(SwPaM& rPam) const
{
- if (!m_pResizeDrawObjects)
+ if (!m_xResizeDrawObjects)
return false;
bool bRet = false;
- sal_uInt16 nCount = m_pResizeDrawObjects->size();
+ sal_uInt16 nCount = m_xResizeDrawObjects->size();
for (sal_uInt16 i = 0; i < nCount && !bRet; ++i)
{
- SdrObject *pObj = (*m_pResizeDrawObjects)[i];
+ SdrObject *pObj = (*m_xResizeDrawObjects)[i];
SwFrameFormat* pObjectFormat = ::FindFrameFormat(pObj);
if (!pObjectFormat)
continue;
diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx
index c8b97d7850a0..81456897d47f 100644
--- a/sw/source/filter/html/wrthtml.cxx
+++ b/sw/source/filter/html/wrthtml.cxx
@@ -344,7 +344,7 @@ ErrCode SwHTMLWriter::WriteStream()
m_pDoc->GetDocShell());
m_xDfltColor.reset();
- m_pFootEndNotes = nullptr;
+ m_xFootEndNotes.reset();
m_pFormatFootnote = nullptr;
m_bOutTable = m_bOutHeader = m_bOutFooter = m_bOutFlyFrame = false;
mxFormComps.clear();
@@ -475,7 +475,7 @@ ErrCode SwHTMLWriter::WriteStream()
if( mxFormComps.is() )
OutForm( false, mxFormComps );
- if( m_pFootEndNotes )
+ if( m_xFootEndNotes )
OutFootEndNotes();
if( !m_bWriteClipboardDoc && m_pDoc->GetDocShell() &&
@@ -523,7 +523,7 @@ ErrCode SwHTMLWriter::WriteStream()
mxFormComps.clear();
- OSL_ENSURE( !m_pFootEndNotes,
+ OSL_ENSURE( !m_xFootEndNotes,
"SwHTMLWriter::Write: Footnotes not deleted by OutFootEndNotes" );
m_pCurrPageDesc = nullptr;
diff --git a/sw/source/filter/html/wrthtml.hxx b/sw/source/filter/html/wrthtml.hxx
index cef3eb788167..38ccf0cf8c46 100644
--- a/sw/source/filter/html/wrthtml.hxx
+++ b/sw/source/filter/html/wrthtml.hxx
@@ -288,7 +288,7 @@ public:
SwHTMLFormatInfos m_CharFormatInfos;
SwHTMLFormatInfos m_TextCollInfos;
std::vector<SwFormatINetFormat*> m_aINetFormats; // the "open" INet attributes
- std::unique_ptr<std::vector<SwTextFootnote*>> m_pFootEndNotes;
+ std::optional<std::vector<SwTextFootnote*>> m_xFootEndNotes;
OUString m_aCSS1Selector; // style selector
OUString m_aNonConvertableCharacters;
diff --git a/sw/source/filter/writer/writer.cxx b/sw/source/filter/writer/writer.cxx
index 8076b23a5bb5..88538e6c46e0 100644
--- a/sw/source/filter/writer/writer.cxx
+++ b/sw/source/filter/writer/writer.cxx
@@ -65,7 +65,7 @@ struct Writer_Impl
{
SvStream * m_pStream;
- std::unique_ptr< std::map<OUString, OUString> > pFileNameMap;
+ std::optional< std::map<OUString, OUString> > xFileNameMap;
std::vector<const SvxFontItem*> aFontRemoveLst;
SwBookmarkNodeTable aBkmkNodePos;
@@ -312,11 +312,11 @@ bool Writer::CopyLocalFileToINet( OUString& rFileNm )
INetProtocol::VndSunStarWebdav >= aTargetUrl.GetProtocol() ) )
return bRet;
- if (m_pImpl->pFileNameMap)
+ if (m_pImpl->xFileNameMap)
{
// has the file been moved?
- std::map<OUString, OUString>::iterator it = m_pImpl->pFileNameMap->find( rFileNm );
- if ( it != m_pImpl->pFileNameMap->end() )
+ std::map<OUString, OUString>::iterator it = m_pImpl->xFileNameMap->find( rFileNm );
+ if ( it != m_pImpl->xFileNameMap->end() )
{
rFileNm = it->second;
return true;
@@ -324,7 +324,7 @@ bool Writer::CopyLocalFileToINet( OUString& rFileNm )
}
else
{
- m_pImpl->pFileNameMap.reset( new std::map<OUString, OUString> );
+ m_pImpl->xFileNameMap.emplace();
}
OUString aSrc = rFileNm;
@@ -342,7 +342,7 @@ bool Writer::CopyLocalFileToINet( OUString& rFileNm )
if( bRet )
{
- m_pImpl->pFileNameMap->insert( std::make_pair( aSrc, aDest ) );
+ m_pImpl->xFileNameMap->insert( std::make_pair( aSrc, aDest ) );
rFileNm = aDest;
}