[Libreoffice-commits] core.git: editeng/source include/editeng include/svx sc/inc sc/source sd/source svx/source sw/inc sw/source
Caolán McNamara
caolanm at redhat.com
Thu Jul 6 07:28:38 UTC 2017
editeng/source/editeng/editeng.cxx | 2 +-
editeng/source/editeng/eerdll.cxx | 8 +++-----
editeng/source/editeng/eerdll2.hxx | 6 +++---
editeng/source/editeng/impedit.hxx | 6 +++---
editeng/source/editeng/impedit2.cxx | 8 ++++----
editeng/source/outliner/outlin2.cxx | 4 ++--
editeng/source/uno/UnoForbiddenCharsTable.cxx | 14 +++++++-------
include/editeng/UnoForbiddenCharsTable.hxx | 7 +++----
include/editeng/editeng.hxx | 2 +-
include/editeng/forbiddencharacterstable.hxx | 2 +-
include/editeng/outliner.hxx | 2 +-
include/svx/svdmodel.hxx | 6 +++---
sc/inc/document.hxx | 6 +++---
sc/source/core/data/documen9.cxx | 4 ++--
sc/source/ui/docshell/docsh2.cxx | 8 ++++----
sc/source/ui/unoobj/forbiuno.cxx | 9 ++++-----
sd/source/core/drawdoc.cxx | 2 +-
svx/source/svdraw/svdmodel.cxx | 4 ++--
sw/inc/IDocumentSettingAccess.hxx | 6 +++---
sw/source/core/doc/DocumentSettingManager.cxx | 20 ++++++++------------
sw/source/core/inc/DocumentSettingManager.hxx | 6 +++---
sw/source/uibase/uno/unotxdoc.cxx | 2 +-
22 files changed, 63 insertions(+), 71 deletions(-)
New commits:
commit 12a3f5cefeaeb842507dd8038597fb77ca929dd1
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Jul 4 15:05:34 2017 +0100
rework as a shared_ptr
mostly to try and track down a crash on exit of sw uwriter under
windows
Change-Id: Id67e93863056da319dd8225038d60a7f5783b103
Reviewed-on: https://gerrit.libreoffice.org/39604
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 7b3040092e90..e5727ee0ba9b 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -2174,7 +2174,7 @@ void EditEngine::SetAllMisspellRanges( const std::vector<editeng::MisspellRanges
pImpEditEngine->SetAllMisspellRanges(rRanges);
}
-void EditEngine::SetForbiddenCharsTable( const rtl::Reference<SvxForbiddenCharactersTable>& xForbiddenChars )
+void EditEngine::SetForbiddenCharsTable(const std::shared_ptr<SvxForbiddenCharactersTable>& xForbiddenChars)
{
ImpEditEngine::SetForbiddenCharsTable( xForbiddenChars );
}
diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx
index 8176096afafc..04ae2c953bf5 100644
--- a/editeng/source/editeng/eerdll.cxx
+++ b/editeng/source/editeng/eerdll.cxx
@@ -176,12 +176,10 @@ std::shared_ptr<DefItems> GlobalEditData::GetDefItems()
return xDefItems;
}
-rtl::Reference<SvxForbiddenCharactersTable> const & GlobalEditData::GetForbiddenCharsTable()
+std::shared_ptr<SvxForbiddenCharactersTable> const & GlobalEditData::GetForbiddenCharsTable()
{
- if ( !xForbiddenCharsTable.is() )
- {
- xForbiddenCharsTable = new SvxForbiddenCharactersTable( ::comphelper::getProcessComponentContext() );
- }
+ if (!xForbiddenCharsTable)
+ xForbiddenCharsTable.reset(new SvxForbiddenCharactersTable(::comphelper::getProcessComponentContext()));
return xForbiddenCharsTable;
}
diff --git a/editeng/source/editeng/eerdll2.hxx b/editeng/source/editeng/eerdll2.hxx
index 6ef3c20d1d92..b8ff6773e716 100644
--- a/editeng/source/editeng/eerdll2.hxx
+++ b/editeng/source/editeng/eerdll2.hxx
@@ -55,13 +55,13 @@ class GlobalEditData
private:
css::uno::Reference< css::linguistic2::XLanguageGuessing > xLanguageGuesser;
std::weak_ptr<DefItems> m_xDefItems;
- rtl::Reference<SvxForbiddenCharactersTable> xForbiddenCharsTable;
+ std::shared_ptr<SvxForbiddenCharactersTable> xForbiddenCharsTable;
public:
std::shared_ptr<DefItems> GetDefItems();
- rtl::Reference<SvxForbiddenCharactersTable> const & GetForbiddenCharsTable();
- void SetForbiddenCharsTable( rtl::Reference<SvxForbiddenCharactersTable> const & xForbiddenChars ) { xForbiddenCharsTable = xForbiddenChars; }
+ std::shared_ptr<SvxForbiddenCharactersTable> const & GetForbiddenCharsTable();
+ void SetForbiddenCharsTable(std::shared_ptr<SvxForbiddenCharactersTable> const & xForbiddenChars ) { xForbiddenCharsTable = xForbiddenChars; }
css::uno::Reference< css::linguistic2::XLanguageGuessing > const & GetLanguageGuesser();
};
diff --git a/editeng/source/editeng/impedit.hxx b/editeng/source/editeng/impedit.hxx
index 303920f6a3b0..cd78e2a916ce 100644
--- a/editeng/source/editeng/impedit.hxx
+++ b/editeng/source/editeng/impedit.hxx
@@ -498,7 +498,7 @@ private:
Link<EditView*,void> maBeginDropHdl;
Link<EditView*,void> maEndDropHdl;
- rtl::Reference<SvxForbiddenCharactersTable> xForbiddenCharsTable;
+ std::shared_ptr<SvxForbiddenCharactersTable> xForbiddenCharsTable;
bool bKernAsianPunctuation:1;
bool bAddExtLeading:1;
@@ -1014,8 +1014,8 @@ public:
void SetAddExtLeading( bool b );
bool IsAddExtLeading() const { return bAddExtLeading; }
- rtl::Reference<SvxForbiddenCharactersTable> GetForbiddenCharsTable() const;
- static void SetForbiddenCharsTable( const rtl::Reference<SvxForbiddenCharactersTable>& xForbiddenChars );
+ std::shared_ptr<SvxForbiddenCharactersTable> GetForbiddenCharsTable() const;
+ static void SetForbiddenCharsTable( const std::shared_ptr<SvxForbiddenCharactersTable>& xForbiddenChars );
/** sets a link that is called at the beginning of a drag operation at an edit view */
void SetBeginDropHdl( const Link<EditView*,void>& rLink ) { maBeginDropHdl = rLink; }
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 695bc15af8fc..f6c0eb4dcc30 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -4366,15 +4366,15 @@ void ImpEditEngine::IndentBlock( EditView* pEditView, bool bRight )
}
}
-rtl::Reference<SvxForbiddenCharactersTable> ImpEditEngine::GetForbiddenCharsTable() const
+std::shared_ptr<SvxForbiddenCharactersTable> ImpEditEngine::GetForbiddenCharsTable() const
{
- rtl::Reference<SvxForbiddenCharactersTable> xF = xForbiddenCharsTable;
- if ( !xF.is() )
+ std::shared_ptr<SvxForbiddenCharactersTable> xF = xForbiddenCharsTable;
+ if (!xF)
xF = EditDLL::Get().GetGlobalData()->GetForbiddenCharsTable();
return xF;
}
-void ImpEditEngine::SetForbiddenCharsTable( const rtl::Reference<SvxForbiddenCharactersTable>& xForbiddenChars )
+void ImpEditEngine::SetForbiddenCharsTable(const std::shared_ptr<SvxForbiddenCharactersTable>& xForbiddenChars)
{
EditDLL::Get().GetGlobalData()->SetForbiddenCharsTable( xForbiddenChars );
}
diff --git a/editeng/source/outliner/outlin2.cxx b/editeng/source/outliner/outlin2.cxx
index 5f8cadb512ed..88b853140ec9 100644
--- a/editeng/source/outliner/outlin2.cxx
+++ b/editeng/source/outliner/outlin2.cxx
@@ -398,9 +398,9 @@ Reference< XSpellChecker1 > Outliner::GetSpeller()
return pEditEngine->GetSpeller();
}
-void Outliner::SetForbiddenCharsTable( const rtl::Reference<SvxForbiddenCharactersTable>& xForbiddenChars )
+void Outliner::SetForbiddenCharsTable(const std::shared_ptr<SvxForbiddenCharactersTable>& xForbiddenChars)
{
- EditEngine::SetForbiddenCharsTable( xForbiddenChars );
+ EditEngine::SetForbiddenCharsTable(xForbiddenChars);
}
void Outliner::SetHyphenator( Reference< XHyphenator >& xHyph )
diff --git a/editeng/source/uno/UnoForbiddenCharsTable.cxx b/editeng/source/uno/UnoForbiddenCharsTable.cxx
index bfa10a6ca526..35e0bed8b494 100644
--- a/editeng/source/uno/UnoForbiddenCharsTable.cxx
+++ b/editeng/source/uno/UnoForbiddenCharsTable.cxx
@@ -32,8 +32,8 @@ using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::i18n;
using namespace ::cppu;
-SvxUnoForbiddenCharsTable::SvxUnoForbiddenCharsTable(::rtl::Reference<SvxForbiddenCharactersTable> const & xForbiddenChars) :
- mxForbiddenChars( xForbiddenChars )
+SvxUnoForbiddenCharsTable::SvxUnoForbiddenCharsTable(std::shared_ptr<SvxForbiddenCharactersTable> const & xForbiddenChars)
+ : mxForbiddenChars(xForbiddenChars)
{
}
@@ -49,7 +49,7 @@ ForbiddenCharacters SvxUnoForbiddenCharsTable::getForbiddenCharacters( const lan
{
SolarMutexGuard aGuard;
- if(!mxForbiddenChars.is())
+ if (!mxForbiddenChars)
throw RuntimeException();
const LanguageType eLang = LanguageTag::convertToLanguageType( rLocale );
@@ -64,7 +64,7 @@ sal_Bool SvxUnoForbiddenCharsTable::hasForbiddenCharacters( const lang::Locale&
{
SolarMutexGuard aGuard;
- if(!mxForbiddenChars.is())
+ if (!mxForbiddenChars)
return false;
const LanguageType eLang = LanguageTag::convertToLanguageType( rLocale );
@@ -77,7 +77,7 @@ void SvxUnoForbiddenCharsTable::setForbiddenCharacters(const lang::Locale& rLoca
{
SolarMutexGuard aGuard;
- if(!mxForbiddenChars.is())
+ if (!mxForbiddenChars)
throw RuntimeException();
const LanguageType eLang = LanguageTag::convertToLanguageType( rLocale );
@@ -90,7 +90,7 @@ void SvxUnoForbiddenCharsTable::removeForbiddenCharacters( const lang::Locale& r
{
SolarMutexGuard aGuard;
- if(!mxForbiddenChars.is())
+ if (!mxForbiddenChars)
throw RuntimeException();
const LanguageType eLang = LanguageTag::convertToLanguageType( rLocale );
@@ -104,7 +104,7 @@ Sequence< lang::Locale > SAL_CALL SvxUnoForbiddenCharsTable::getLocales()
{
SolarMutexGuard aGuard;
- const sal_Int32 nCount = mxForbiddenChars.is() ? mxForbiddenChars->GetMap().size() : 0;
+ const sal_Int32 nCount = mxForbiddenChars ? mxForbiddenChars->GetMap().size() : 0;
Sequence< lang::Locale > aLocales( nCount );
if( nCount )
diff --git a/include/editeng/UnoForbiddenCharsTable.hxx b/include/editeng/UnoForbiddenCharsTable.hxx
index 924d9f7fa5f0..2697e5dc59cc 100644
--- a/include/editeng/UnoForbiddenCharsTable.hxx
+++ b/include/editeng/UnoForbiddenCharsTable.hxx
@@ -22,10 +22,9 @@
#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
#include <com/sun/star/linguistic2/XSupportedLocales.hpp>
-#include <rtl/ref.hxx>
-
#include <cppuhelper/implbase.hxx>
#include <editeng/editengdllapi.h>
+#include <memory>
class SvxForbiddenCharactersTable;
@@ -37,10 +36,10 @@ protected:
/** this virtual function is called if the forbidden characters are changed */
virtual void onChange();
- rtl::Reference<SvxForbiddenCharactersTable> mxForbiddenChars;
+ std::shared_ptr<SvxForbiddenCharactersTable> mxForbiddenChars;
public:
- SvxUnoForbiddenCharsTable(rtl::Reference<SvxForbiddenCharactersTable> const & xForbiddenChars);
+ SvxUnoForbiddenCharsTable(std::shared_ptr<SvxForbiddenCharactersTable> const & xForbiddenChars);
virtual ~SvxUnoForbiddenCharsTable() override;
// XForbiddenCharacters
diff --git a/include/editeng/editeng.hxx b/include/editeng/editeng.hxx
index 05ccb792d5f6..71421453752e 100644
--- a/include/editeng/editeng.hxx
+++ b/include/editeng/editeng.hxx
@@ -426,7 +426,7 @@ public:
void GetAllMisspellRanges( std::vector<editeng::MisspellRanges>& rRanges ) const;
void SetAllMisspellRanges( const std::vector<editeng::MisspellRanges>& rRanges );
- static void SetForbiddenCharsTable( const rtl::Reference<SvxForbiddenCharactersTable>& xForbiddenChars );
+ static void SetForbiddenCharsTable(const std::shared_ptr<SvxForbiddenCharactersTable>& xForbiddenChars);
void SetDefaultLanguage( LanguageType eLang );
LanguageType GetDefaultLanguage() const;
diff --git a/include/editeng/forbiddencharacterstable.hxx b/include/editeng/forbiddencharacterstable.hxx
index b14828593112..6923f550070d 100644
--- a/include/editeng/forbiddencharacterstable.hxx
+++ b/include/editeng/forbiddencharacterstable.hxx
@@ -34,7 +34,7 @@ namespace uno {
class XComponentContext;
}}}}
-class EDITENG_DLLPUBLIC SvxForbiddenCharactersTable : public salhelper::SimpleReferenceObject
+class EDITENG_DLLPUBLIC SvxForbiddenCharactersTable
{
public:
typedef std::map<LanguageType, css::i18n::ForbiddenCharacters> Map;
diff --git a/include/editeng/outliner.hxx b/include/editeng/outliner.hxx
index 80a16b518037..f7a015b4a0a5 100644
--- a/include/editeng/outliner.hxx
+++ b/include/editeng/outliner.hxx
@@ -912,7 +912,7 @@ public:
GetSpeller();
void SetHyphenator( css::uno::Reference< css::linguistic2::XHyphenator >& xHyph );
- static void SetForbiddenCharsTable( const rtl::Reference<SvxForbiddenCharactersTable>& xForbiddenChars );
+ static void SetForbiddenCharsTable(const std::shared_ptr<SvxForbiddenCharactersTable>& xForbiddenChars);
// Deprecated
void SetDefaultLanguage( LanguageType eLang );
diff --git a/include/svx/svdmodel.hxx b/include/svx/svdmodel.hxx
index 95e613ef767d..b9210f5d072d 100644
--- a/include/svx/svdmodel.hxx
+++ b/include/svx/svdmodel.hxx
@@ -194,7 +194,7 @@ protected:
public:
- rtl::Reference<SvxForbiddenCharactersTable> mpForbiddenCharactersTable;
+ std::shared_ptr<SvxForbiddenCharactersTable> mpForbiddenCharactersTable;
SdrSwapGraphicsMode nSwapGraphicsMode;
SdrOutlinerCache* mpOutlinerCache;
@@ -522,8 +522,8 @@ public:
bool isLocked() const { return mbModelLocked; }
void setLock( bool bLock );
- void SetForbiddenCharsTable( const rtl::Reference<SvxForbiddenCharactersTable>& xForbiddenChars );
- const rtl::Reference<SvxForbiddenCharactersTable>& GetForbiddenCharsTable() const { return mpForbiddenCharactersTable;}
+ void SetForbiddenCharsTable( const std::shared_ptr<SvxForbiddenCharactersTable>& xForbiddenChars );
+ const std::shared_ptr<SvxForbiddenCharactersTable>& GetForbiddenCharsTable() const { return mpForbiddenCharactersTable;}
void SetCharCompressType( CharCompressType nType );
CharCompressType GetCharCompressType() const { return mnCharCompressType; }
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index e54fb190a96c..a2d496538124 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -348,7 +348,7 @@ private:
ScChangeViewSettings* pChangeViewSettings;
ScScriptTypeData* pScriptTypeData;
ScRefreshTimerControl* pRefreshTimerControl;
- rtl::Reference<SvxForbiddenCharactersTable> xForbiddenCharacters;
+ std::shared_ptr<SvxForbiddenCharactersTable> xForbiddenCharacters;
ScDBData* mpAnonymousDBData;
ScFieldEditEngine* pCacheFieldEditEngine;
@@ -1972,8 +1972,8 @@ public:
ScChangeViewSettings* GetChangeViewSettings() const { return pChangeViewSettings; }
SC_DLLPUBLIC void SetChangeViewSettings(const ScChangeViewSettings& rNew);
- const rtl::Reference<SvxForbiddenCharactersTable>& GetForbiddenCharacters();
- void SetForbiddenCharacters(const rtl::Reference<SvxForbiddenCharactersTable>& rNew);
+ const std::shared_ptr<SvxForbiddenCharactersTable>& GetForbiddenCharacters();
+ void SetForbiddenCharacters(const std::shared_ptr<SvxForbiddenCharactersTable>& rNew);
CharCompressType GetAsianCompression() const;
bool IsValidAsianCompression() const;
diff --git a/sc/source/core/data/documen9.cxx b/sc/source/core/data/documen9.cxx
index 60928ff8ae4b..b62441e8037b 100644
--- a/sc/source/core/data/documen9.cxx
+++ b/sc/source/core/data/documen9.cxx
@@ -625,12 +625,12 @@ void ScDocument::SetImportingXML( bool bVal )
SetLoadingMedium(bVal);
}
-const rtl::Reference<SvxForbiddenCharactersTable>& ScDocument::GetForbiddenCharacters()
+const std::shared_ptr<SvxForbiddenCharactersTable>& ScDocument::GetForbiddenCharacters()
{
return xForbiddenCharacters;
}
-void ScDocument::SetForbiddenCharacters(const rtl::Reference<SvxForbiddenCharactersTable>& rNew)
+void ScDocument::SetForbiddenCharacters(const std::shared_ptr<SvxForbiddenCharactersTable>& rNew)
{
xForbiddenCharacters = rNew;
if ( pEditEngine )
diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx
index e656dc49ce72..4055666e2201 100644
--- a/sc/source/ui/docshell/docsh2.cxx
+++ b/sc/source/ui/docshell/docsh2.cxx
@@ -115,20 +115,20 @@ void ScDocShell::InitItems()
PutItem( SvxColorListItem( XColorList::GetStdColorList(), SID_COLOR_TABLE ) );
}
- if ( !aDocument.GetForbiddenCharacters().is() ||
+ if ( !aDocument.GetForbiddenCharacters() ||
!aDocument.IsValidAsianCompression() || !aDocument.IsValidAsianKerning() )
{
// get settings from SvxAsianConfig
SvxAsianConfig aAsian;
- if ( !aDocument.GetForbiddenCharacters().is() )
+ if (!aDocument.GetForbiddenCharacters())
{
// set forbidden characters if necessary
uno::Sequence<lang::Locale> aLocales = aAsian.GetStartEndCharLocales();
if (aLocales.getLength())
{
- rtl::Reference<SvxForbiddenCharactersTable> xForbiddenTable =
- new SvxForbiddenCharactersTable( comphelper::getProcessComponentContext() );
+ std::shared_ptr<SvxForbiddenCharactersTable> xForbiddenTable(
+ new SvxForbiddenCharactersTable(comphelper::getProcessComponentContext()));
const lang::Locale* pLocales = aLocales.getConstArray();
for (sal_Int32 i = 0; i < aLocales.getLength(); i++)
diff --git a/sc/source/ui/unoobj/forbiuno.cxx b/sc/source/ui/unoobj/forbiuno.cxx
index 2ad3874ea97f..732487b0defc 100644
--- a/sc/source/ui/unoobj/forbiuno.cxx
+++ b/sc/source/ui/unoobj/forbiuno.cxx
@@ -24,19 +24,18 @@
using namespace ::com::sun::star;
-static rtl::Reference<SvxForbiddenCharactersTable> lcl_GetForbidden( ScDocShell* pDocSh )
+static std::shared_ptr<SvxForbiddenCharactersTable> lcl_GetForbidden( ScDocShell* pDocSh )
{
- rtl::Reference<SvxForbiddenCharactersTable> xRet;
+ std::shared_ptr<SvxForbiddenCharactersTable> xRet;
if ( pDocSh )
{
ScDocument& rDoc = pDocSh->GetDocument();
xRet = rDoc.GetForbiddenCharacters();
- if ( !xRet.is() )
+ if (!xRet)
{
// create an empty SvxForbiddenCharactersTable for SvxUnoForbiddenCharsTable,
// so changes can be stored.
-
- xRet = new SvxForbiddenCharactersTable( comphelper::getProcessComponentContext() );
+ xRet.reset(new SvxForbiddenCharactersTable(comphelper::getProcessComponentContext()));
rDoc.SetForbiddenCharacters( xRet );
}
}
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 727b7d0b29af..a22e60f0ff8d 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -260,7 +260,7 @@ SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
if( xHyphenator.is() )
rOutliner.SetHyphenator( xHyphenator );
- SetForbiddenCharsTable( new SvxForbiddenCharactersTable( ::comphelper::getProcessComponentContext() ) );
+ SetForbiddenCharsTable(std::make_shared<SvxForbiddenCharactersTable>(::comphelper::getProcessComponentContext()));
}
catch(...)
{
diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx
index 8981e4c415ff..713d0222d3cf 100644
--- a/svx/source/svdraw/svdmodel.cxx
+++ b/svx/source/svdraw/svdmodel.cxx
@@ -290,7 +290,7 @@ SdrModel::~SdrModel()
SfxItemPool::Free(pOutlPool);
}
- mpForbiddenCharactersTable.clear();
+ mpForbiddenCharactersTable.reset();
delete mpImpl->mpUndoFactory;
}
@@ -1842,7 +1842,7 @@ void SdrModel::MigrateItemSet( const SfxItemSet* pSourceSet, SfxItemSet* pDestSe
}
-void SdrModel::SetForbiddenCharsTable( const rtl::Reference<SvxForbiddenCharactersTable>& xForbiddenChars )
+void SdrModel::SetForbiddenCharsTable(const std::shared_ptr<SvxForbiddenCharactersTable>& xForbiddenChars)
{
mpForbiddenCharactersTable = xForbiddenChars;
diff --git a/sw/inc/IDocumentSettingAccess.hxx b/sw/inc/IDocumentSettingAccess.hxx
index 7822215057d7..00d4c44df041 100644
--- a/sw/inc/IDocumentSettingAccess.hxx
+++ b/sw/inc/IDocumentSettingAccess.hxx
@@ -21,9 +21,9 @@
#define INCLUDED_SW_INC_IDOCUMENTSETTINGACCESS_HXX
#include <tools/solar.h>
-#include <rtl/ref.hxx>
#include <fldupde.hxx>
#include <i18nlangtag/lang.h>
+#include <memory>
class SvxForbiddenCharactersTable;
namespace com { namespace sun { namespace star { namespace i18n { struct ForbiddenCharacters; } } } }
@@ -155,14 +155,14 @@ enum class DocumentSettingId
@returns
the forbidden characters table.
*/
- virtual rtl::Reference<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() = 0;
+ virtual std::shared_ptr<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() = 0;
/** Get the forbidden character table.
@returns
the forbidden characters table.
*/
- virtual const rtl::Reference<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() const = 0;
+ virtual const std::shared_ptr<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() const = 0;
/** Get the current link update mode.
diff --git a/sw/source/core/doc/DocumentSettingManager.cxx b/sw/source/core/doc/DocumentSettingManager.cxx
index 9330dbe1bb32..f8f38b4dde73 100644
--- a/sw/source/core/doc/DocumentSettingManager.cxx
+++ b/sw/source/core/doc/DocumentSettingManager.cxx
@@ -421,7 +421,7 @@ const css::i18n::ForbiddenCharacters*
sw::DocumentSettingManager::getForbiddenCharacters(/*[in]*/ LanguageType nLang, /*[in]*/ bool bLocaleData ) const
{
const css::i18n::ForbiddenCharacters* pRet = nullptr;
- if( mxForbiddenCharsTable.is() )
+ if (mxForbiddenCharsTable)
pRet = mxForbiddenCharsTable->GetForbiddenCharacters( nLang, false );
if( bLocaleData && !pRet && g_pBreakIt )
pRet = &g_pBreakIt->GetForbidden( nLang );
@@ -431,16 +431,14 @@ const css::i18n::ForbiddenCharacters*
void sw::DocumentSettingManager::setForbiddenCharacters(/*[in]*/ LanguageType nLang,
/*[in]*/ const css::i18n::ForbiddenCharacters& rFChars )
{
- if( !mxForbiddenCharsTable.is() )
- {
- mxForbiddenCharsTable = new SvxForbiddenCharactersTable( ::comphelper::getProcessComponentContext() );
- }
+ if (!mxForbiddenCharsTable)
+ mxForbiddenCharsTable.reset(new SvxForbiddenCharactersTable(::comphelper::getProcessComponentContext()));
mxForbiddenCharsTable->SetForbiddenCharacters( nLang, rFChars );
SdrModel *pDrawModel = m_rDoc.getIDocumentDrawModelAccess().GetDrawModel();
if( pDrawModel )
{
- pDrawModel->SetForbiddenCharsTable( mxForbiddenCharsTable );
+ pDrawModel->SetForbiddenCharsTable(mxForbiddenCharsTable);
if( !m_rDoc.IsInReading() )
pDrawModel->ReformatAllTextObjects();
}
@@ -456,16 +454,14 @@ void sw::DocumentSettingManager::setForbiddenCharacters(/*[in]*/ LanguageType nL
m_rDoc.getIDocumentState().SetModified();
}
-rtl::Reference<SvxForbiddenCharactersTable>& sw::DocumentSettingManager::getForbiddenCharacterTable()
+std::shared_ptr<SvxForbiddenCharactersTable>& sw::DocumentSettingManager::getForbiddenCharacterTable()
{
- if( !mxForbiddenCharsTable.is() )
- {
- mxForbiddenCharsTable = new SvxForbiddenCharactersTable( ::comphelper::getProcessComponentContext() );
- }
+ if (!mxForbiddenCharsTable)
+ mxForbiddenCharsTable.reset(new SvxForbiddenCharactersTable(::comphelper::getProcessComponentContext()));
return mxForbiddenCharsTable;
}
-const rtl::Reference<SvxForbiddenCharactersTable>& sw::DocumentSettingManager::getForbiddenCharacterTable() const
+const std::shared_ptr<SvxForbiddenCharactersTable>& sw::DocumentSettingManager::getForbiddenCharacterTable() const
{
return mxForbiddenCharsTable;
}
diff --git a/sw/source/core/inc/DocumentSettingManager.hxx b/sw/source/core/inc/DocumentSettingManager.hxx
index 9c0094910be2..81dca8d42780 100644
--- a/sw/source/core/inc/DocumentSettingManager.hxx
+++ b/sw/source/core/inc/DocumentSettingManager.hxx
@@ -26,7 +26,7 @@ namespace sw {
class DocumentSettingManager :
public IDocumentSettingAccess
{
- rtl::Reference<SvxForbiddenCharactersTable> mxForbiddenCharsTable;
+ std::shared_ptr<SvxForbiddenCharactersTable> mxForbiddenCharsTable;
SwDoc &m_rDoc;
sal_uInt16 mnLinkUpdMode; //< UpdateMode for links.
@@ -165,8 +165,8 @@ public:
virtual void set(/*[in]*/ DocumentSettingId id, /*[in]*/ bool value) override;
virtual const css::i18n::ForbiddenCharacters* getForbiddenCharacters(/*[in]*/ LanguageType nLang, /*[in]*/ bool bLocaleData ) const override;
virtual void setForbiddenCharacters(/*[in]*/ LanguageType nLang, /*[in]*/ const css::i18n::ForbiddenCharacters& rForbiddenCharacters ) override;
- virtual rtl::Reference<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() override;
- virtual const rtl::Reference<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() const override;
+ virtual std::shared_ptr<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() override;
+ virtual const std::shared_ptr<SvxForbiddenCharactersTable>& getForbiddenCharacterTable() const override;
virtual sal_uInt16 getLinkUpdateMode( /*[in]*/bool bGlobalSettings ) const override;
virtual void setLinkUpdateMode( /*[in]*/ sal_uInt16 nMode ) override;
virtual SwFieldUpdateFlags getFieldUpdateFlags( /*[in]*/bool bGlobalSettings ) const override;
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 9a63b496b8f1..83fd4ba778ba 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -4285,7 +4285,7 @@ void SwXDocumentPropertyHelper::Invalidate()
xMarkerTable = nullptr;
xDrawDefaults = nullptr;
m_pDoc = nullptr;
- SvxUnoForbiddenCharsTable::mxForbiddenChars.clear();
+ SvxUnoForbiddenCharsTable::mxForbiddenChars.reset();
}
void SwXDocumentPropertyHelper::onChange()
More information about the Libreoffice-commits
mailing list