[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - lotuswordpro/inc lotuswordpro/source
lotuswordpro/inc/lwpbookmarkmgr.hxx |4 +-- lotuswordpro/source/filter/lwpbookmarkmgr.cxx | 29 +++--- 2 files changed, 15 insertions(+), 18 deletions(-) New commits: commit 717e0853dce50c33b61ea8541d24186e40e84c73 Author: Caolán McNamaraDate: Thu Mar 22 10:35:18 2018 + ofz#7063 ensure lifecycle Change-Id: I18d62bc3bd409ca65c85ea47e8d5b3930481edf9 Reviewed-on: https://gerrit.libreoffice.org/51732 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/lotuswordpro/inc/lwpbookmarkmgr.hxx b/lotuswordpro/inc/lwpbookmarkmgr.hxx index 08ea7e35c803..926d4e391934 100644 --- a/lotuswordpro/inc/lwpbookmarkmgr.hxx +++ b/lotuswordpro/inc/lwpbookmarkmgr.hxx @@ -75,8 +75,8 @@ public: ~LwpBookmarkMgr(); LwpBookmarkMgr(); private: -std::map m_MapStart; -std::map m_MapEnd; +std::map m_MapStart; +std::map m_MapEnd; }; #endif diff --git a/lotuswordpro/source/filter/lwpbookmarkmgr.cxx b/lotuswordpro/source/filter/lwpbookmarkmgr.cxx index fdfed20edf6c..3ce1ef05355e 100644 --- a/lotuswordpro/source/filter/lwpbookmarkmgr.cxx +++ b/lotuswordpro/source/filter/lwpbookmarkmgr.cxx @@ -57,44 +57,41 @@ void LwpBookmarkMgr::AddXFBookmarkStart(const OUString& sName,XFBookmarkStart* pMark) { -std::map ::iterator iter; -iter = m_MapStart.find(sName); +auto iter = m_MapStart.find(sName); if (iter == m_MapStart.end())//not find { m_MapStart[sName] = pMark; } else //have exist the same bookmark name { -XFBookmarkStart* pFind = iter->second; -OUString totalName = pFind->GetDivision() + ":"; -totalName += pFind->GetName(); -pFind->SetName(totalName); -m_MapStart[totalName] = pFind; +auto xFind = iter->second; +OUString totalName = xFind->GetDivision() + ":"; +totalName += xFind->GetName(); +xFind->SetName(totalName); +m_MapStart[totalName] = xFind; m_MapStart[sName] = pMark; } } void LwpBookmarkMgr::AddXFBookmarkEnd(const OUString& sName,XFBookmarkEnd* pMark) { -std::map ::iterator iter; -iter = m_MapEnd.find(sName); +auto iter = m_MapEnd.find(sName); if (iter == m_MapEnd.end())//not find { m_MapEnd[sName] = pMark; } else //have exist the same bookmark name { -XFBookmarkEnd* pFind = iter->second; -OUString totalName = pFind->GetDivision() + ":"; -totalName += pFind->GetName(); -pFind->SetName(totalName); -m_MapEnd[totalName] = pFind; +auto xFind = iter->second; +OUString totalName = xFind->GetDivision() + ":"; +totalName += xFind->GetName(); +xFind->SetName(totalName); +m_MapEnd[totalName] = xFind; m_MapEnd[sName] = pMark; } } bool LwpBookmarkMgr::FindBookmark(const OUString& sName) { -std::map ::iterator iter; -iter = m_MapStart.find(sName); +auto iter = m_MapStart.find(sName); return iter != m_MapStart.end(); } ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
[Libreoffice-commits] core.git: Branch 'libreoffice-6-0' - lotuswordpro/inc lotuswordpro/source
lotuswordpro/inc/lwpfrib.hxx|4 lotuswordpro/source/filter/lwpchangemgr.cxx |2 ++ lotuswordpro/source/filter/lwpfrib.cxx | 18 +- 3 files changed, 23 insertions(+), 1 deletion(-) New commits: commit a4bae5beeb71edb8b3ac51f9775e16a889560524 Author: Caolán McNamaraDate: Fri Jan 12 09:43:41 2018 + ofz#5254 Bad-cast Change-Id: I318d441d841dd4c783f87ac2f3f699852e8b1039 Reviewed-on: https://gerrit.libreoffice.org/47804 Tested-by: Jenkins Reviewed-by: Michael Stahl diff --git a/lotuswordpro/inc/lwpfrib.hxx b/lotuswordpro/inc/lwpfrib.hxx index 4e824c0002f4..6ff3cad39a98 100644 --- a/lotuswordpro/inc/lwpfrib.hxx +++ b/lotuswordpro/inc/lwpfrib.hxx @@ -97,6 +97,7 @@ public: OUString GetEditor(); XFColor GetHighlightColor(); protected: +std::map * m_pFribMap; LwpPara* m_pPara; LwpFrib* m_pNext; sal_uInt8 m_nFribType; @@ -119,6 +120,9 @@ public: REV_INSERT =0, REV_DELETE = 1, }; + +void Register(std::map * pFribMap); +void Deregister(); private: static void ReadModifiers(LwpObjectStream* pObjStrm,ModifierInfo* pModInfo); protected: diff --git a/lotuswordpro/source/filter/lwpchangemgr.cxx b/lotuswordpro/source/filter/lwpchangemgr.cxx index e08ee979869d..c04241aaccb4 100644 --- a/lotuswordpro/source/filter/lwpchangemgr.cxx +++ b/lotuswordpro/source/filter/lwpchangemgr.cxx @@ -89,6 +89,7 @@ LwpChangeMgr::LwpChangeMgr() m_pFribMap = _DocFribMap; m_ChangeList.clear(); } + LwpChangeMgr::~LwpChangeMgr() { m_pFribMap=nullptr; @@ -102,6 +103,7 @@ void LwpChangeMgr::AddChangeFrib(LwpFrib* pFrib) m_nCounter++; OUString sID = "ct"+ OUString::number(m_nCounter); m_pFribMap->insert(std::pair (pFrib,sID)); +pFrib->Register(m_pFribMap); } OUString LwpChangeMgr::GetChangeID(LwpFrib* pFrib) diff --git a/lotuswordpro/source/filter/lwpfrib.cxx b/lotuswordpro/source/filter/lwpfrib.cxx index f9b3ad759d3c..919b257be043 100644 --- a/lotuswordpro/source/filter/lwpfrib.cxx +++ b/lotuswordpro/source/filter/lwpfrib.cxx @@ -87,7 +87,8 @@ LwpFrib::LwpFrib(LwpPara* pPara) -: m_pPara(pPara) +: m_pFribMap(nullptr) +, m_pPara(pPara) , m_pNext(nullptr) , m_nFribType(0) , m_pModifiers(nullptr) @@ -100,6 +101,7 @@ LwpFrib::LwpFrib(LwpPara* pPara) LwpFrib::~LwpFrib() { +Deregister(); } LwpFrib* LwpFrib::CreateFrib(LwpPara* pPara, LwpObjectStream* pObjStrm, sal_uInt8 fribtag,sal_uInt8 editID) @@ -447,4 +449,18 @@ XFColor LwpFrib::GetHighlightColor() return pGlobal->GetHighlightColor(m_nEditor); } +void LwpFrib::Register(std::map * pFribMap) +{ +m_pFribMap = pFribMap; +} + +void LwpFrib::Deregister() +{ +if (m_pFribMap) +{ +m_pFribMap->erase(this); +m_pFribMap = nullptr; +} +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ ___ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits