From 903a5855e2ccbaa4f828a6359ce31340ea56eade Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 16 Mar 2017 11:58:39 +0100 Subject: No need for extra heap allocation Change-Id: Ibc5424873f6cd4e5e4d9ee37823845b14f17c7fb --- sw/inc/swmodule.hxx | 2 +- sw/source/uibase/app/apphdl.cxx | 1 - sw/source/uibase/app/swmodul1.cxx | 16 ++++++++-------- sw/source/uibase/app/swmodule.cxx | 2 -- 4 files changed, 9 insertions(+), 12 deletions(-) (limited to 'sw') diff --git a/sw/inc/swmodule.hxx b/sw/inc/swmodule.hxx index b124bba088db..a05d90b7c09e 100644 --- a/sw/inc/swmodule.hxx +++ b/sw/inc/swmodule.hxx @@ -96,7 +96,7 @@ class SW_DLLPUBLIC SwModule: public SfxModule, public SfxListener, public utl::C SwView* m_pView; // List of all Redline-authors. - std::vector* m_pAuthorNames; + std::vector m_pAuthorNames; // DictionaryList listener to trigger spellchecking or hyphenation css::uno::Reference< css::linguistic2::XLinguServiceEventListener > m_xLinguServiceEventListener; diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx index 4c791be75347..ef5ac4a90984 100644 --- a/sw/source/uibase/app/apphdl.cxx +++ b/sw/source/uibase/app/apphdl.cxx @@ -887,7 +887,6 @@ void SwModule::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) DELETEZ(m_pNavigationConfig); DELETEZ(m_pToolbarConfig); DELETEZ(m_pWebToolbarConfig); - DELETEZ(m_pAuthorNames); DELETEZ(m_pDBConfig); if( m_pColorConfig ) { diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx index d3e4374ec5b5..f77d5f8b3553 100644 --- a/sw/source/uibase/app/swmodul1.cxx +++ b/sw/source/uibase/app/swmodul1.cxx @@ -417,12 +417,12 @@ void SwModule::SetRedlineAuthor(const OUString &rAuthor) OUString SwModule::GetRedlineAuthor(sal_uInt16 nPos) { - OSL_ENSURE(nPos < m_pAuthorNames->size(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash - while(!(nPos < m_pAuthorNames->size())) + OSL_ENSURE(nPos < m_pAuthorNames.size(), "author not found!"); //#i45342# RTF doc with no author table caused reader to crash + while(!(nPos < m_pAuthorNames.size())) { InsertRedlineAuthor("nn"); } - return (*m_pAuthorNames)[nPos]; + return m_pAuthorNames[nPos]; } static ColorData lcl_GetAuthorColor(sal_uInt16 nPos) @@ -450,9 +450,9 @@ boost::property_tree::ptree lcl_AuthorToJson(const OUString& rAuthor, size_t nIn OUString SwModule::GetRedlineAuthorInfo() { boost::property_tree::ptree aTable; - for (size_t nAuthor = 0; nAuthor < m_pAuthorNames->size(); ++nAuthor) + for (size_t nAuthor = 0; nAuthor < m_pAuthorNames.size(); ++nAuthor) { - boost::property_tree::ptree aAuthor = lcl_AuthorToJson((*m_pAuthorNames)[nAuthor], nAuthor); + boost::property_tree::ptree aAuthor = lcl_AuthorToJson(m_pAuthorNames[nAuthor], nAuthor); aTable.push_back(std::make_pair("", aAuthor)); } @@ -467,11 +467,11 @@ sal_uInt16 SwModule::InsertRedlineAuthor(const OUString& rAuthor) { sal_uInt16 nPos = 0; - while(nPos < m_pAuthorNames->size() && (*m_pAuthorNames)[nPos] != rAuthor) + while(nPos < m_pAuthorNames.size() && m_pAuthorNames[nPos] != rAuthor) ++nPos; - if (nPos == m_pAuthorNames->size()) - m_pAuthorNames->push_back(rAuthor); + if (nPos == m_pAuthorNames.size()) + m_pAuthorNames.push_back(rAuthor); return nPos; } diff --git a/sw/source/uibase/app/swmodule.cxx b/sw/source/uibase/app/swmodule.cxx index bd574866f7f9..e1d7db7bee15 100644 --- a/sw/source/uibase/app/swmodule.cxx +++ b/sw/source/uibase/app/swmodule.cxx @@ -184,8 +184,6 @@ SwModule::SwModule( SfxObjectFactory* pWebFact, m_pStdFontConfig = new SwStdFontConfig; - m_pAuthorNames = new std::vector; // All Redlining-Authors - StartListening( *SfxGetpApp() ); if (!utl::ConfigManager::IsAvoidConfig()) -- cgit v1.2.3