summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-08-13 13:33:08 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-08-13 15:35:36 +0200
commit9753428dfc2bf038188c9a59af7fd2d789b46517 (patch)
tree923a3d1888dbadc38436de76b9cad343be5380fe /editeng
parent53b8fcbd3f81903b171fd59478abf0283c6feb24 (diff)
rtl::Static -> thread-safe static local
Change-Id: If5b7181fb1bb3f3f21ec3742680e5a3e12b21b73 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120431 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/eerdll.cxx9
-rw-r--r--editeng/source/misc/acorrcfg.cxx10
-rw-r--r--editeng/source/uno/unotext.cxx91
-rw-r--r--editeng/source/uno/unotext2.cxx84
4 files changed, 57 insertions, 137 deletions
diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx
index 0e0540bf1244..5e6929ec33a1 100644
--- a/editeng/source/editeng/eerdll.cxx
+++ b/editeng/source/editeng/eerdll.cxx
@@ -64,19 +64,14 @@
#include <editeng/xmlcnitm.hxx>
#include <editeng/forbiddencharacterstable.hxx>
#include <editeng/justifyitem.hxx>
-#include <rtl/instance.hxx>
#include <tools/mapunit.hxx>
using namespace ::com::sun::star;
-namespace
-{
- class theEditDLL : public rtl::Static<EditDLL, theEditDLL> {};
-}
-
EditDLL& EditDLL::Get()
{
- return theEditDLL::get();
+ static EditDLL theEditDLL;
+ return theEditDLL;
}
DefItems::DefItems()
diff --git a/editeng/source/misc/acorrcfg.cxx b/editeng/source/misc/acorrcfg.cxx
index 5489e7d5011f..6d0c0650e416 100644
--- a/editeng/source/misc/acorrcfg.cxx
+++ b/editeng/source/misc/acorrcfg.cxx
@@ -29,8 +29,6 @@
#include <editeng/svxacorr.hxx>
#include <com/sun/star/uno/Sequence.hxx>
-#include <rtl/instance.hxx>
-
using namespace utl;
using namespace com::sun::star;
using namespace com::sun::star::uno;
@@ -601,14 +599,10 @@ void SvxSwAutoCorrCfg::Notify( const Sequence<OUString>& /* aPropertyNames */ )
Load(false);
}
-namespace
-{
- class theSvxAutoCorrCfg : public rtl::Static<SvxAutoCorrCfg, theSvxAutoCorrCfg>{};
-}
-
SvxAutoCorrCfg& SvxAutoCorrCfg::Get()
{
- return theSvxAutoCorrCfg::get();
+ static SvxAutoCorrCfg theSvxAutoCorrCfg;
+ return theSvxAutoCorrCfg;
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 0a3d7f215058..76537f8b425b 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -28,7 +28,6 @@
#include <svl/itemset.hxx>
#include <svl/itempool.hxx>
#include <svl/eitem.hxx>
-#include <rtl/instance.hxx>
#include <tools/debug.hxx>
#include <editeng/unoprnms.hxx>
@@ -1548,36 +1547,19 @@ void SAL_CALL SvxUnoTextRange::release()
// XTypeProvider
-namespace
-{
- struct theSvxUnoTextRangeTypes :
- public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextRangeTypes>
- {
- uno::Sequence<uno::Type> operator () ()
- {
- uno::Sequence< uno::Type > aTypeSequence;
-
- aTypeSequence.realloc( 9 ); // !DANGER! keep this updated
- uno::Type* pTypes = aTypeSequence.getArray();
-
- *pTypes++ = cppu::UnoType<text::XTextRange>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
- *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
- *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
- *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
- *pTypes++ = cppu::UnoType<text::XTextRangeCompare>::get();
-
- return aTypeSequence;
- }
- };
-}
-
uno::Sequence< uno::Type > SAL_CALL SvxUnoTextRange::getTypes()
{
- return theSvxUnoTextRangeTypes::get();
+ static const uno::Sequence< uno::Type > TYPES {
+ cppu::UnoType<text::XTextRange>::get(),
+ cppu::UnoType<beans::XPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertyStates>::get(),
+ cppu::UnoType<beans::XPropertyState>::get(),
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ cppu::UnoType<lang::XUnoTunnel>::get(),
+ cppu::UnoType<text::XTextRangeCompare>::get() };
+ return TYPES;
}
uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextRange::getImplementationId()
@@ -1657,42 +1639,25 @@ uno::Any SAL_CALL SvxUnoTextBase::queryAggregation( const uno::Type & rType )
// XTypeProvider
-namespace
-{
- struct theSvxUnoTextBaseTypes :
- public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextBaseTypes>
- {
- uno::Sequence<uno::Type> operator () ()
- {
- uno::Sequence< uno::Type > aTypeSequence;
-
- aTypeSequence.realloc( 15 ); // !DANGER! keep this updated
- uno::Type* pTypes = aTypeSequence.getArray();
-
- *pTypes++ = cppu::UnoType<text::XText>::get();
- *pTypes++ = cppu::UnoType<container::XEnumerationAccess>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
- *pTypes++ = cppu::UnoType<text::XTextRangeMover>::get();
- *pTypes++ = cppu::UnoType<text::XTextAppend>::get();
- *pTypes++ = cppu::UnoType<text::XTextCopy>::get();
- *pTypes++ = cppu::UnoType<text::XParagraphAppend>::get();
- *pTypes++ = cppu::UnoType<text::XTextPortionAppend>::get();
- *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
- *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
- *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
- *pTypes++ = cppu::UnoType<text::XTextRangeCompare>::get();
-
- return aTypeSequence;
- }
- };
-}
-
uno::Sequence< uno::Type > SAL_CALL SvxUnoTextBase::getTypes()
{
- return theSvxUnoTextBaseTypes::get();
+ static const uno::Sequence< uno::Type > TYPES {
+ cppu::UnoType<text::XText>::get(),
+ cppu::UnoType<container::XEnumerationAccess>::get(),
+ cppu::UnoType<beans::XPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertyStates>::get(),
+ cppu::UnoType<beans::XPropertyState>::get(),
+ cppu::UnoType<text::XTextRangeMover>::get(),
+ cppu::UnoType<text::XTextAppend>::get(),
+ cppu::UnoType<text::XTextCopy>::get(),
+ cppu::UnoType<text::XParagraphAppend>::get(),
+ cppu::UnoType<text::XTextPortionAppend>::get(),
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ cppu::UnoType<lang::XUnoTunnel>::get(),
+ cppu::UnoType<text::XTextRangeCompare>::get() };
+ return TYPES;
}
uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextBase::getImplementationId()
diff --git a/editeng/source/uno/unotext2.cxx b/editeng/source/uno/unotext2.cxx
index f7a2d462e3b3..8ff342d915bb 100644
--- a/editeng/source/uno/unotext2.cxx
+++ b/editeng/source/uno/unotext2.cxx
@@ -181,38 +181,21 @@ void SAL_CALL SvxUnoTextContent::release() noexcept
// XTypeProvider
-namespace
-{
- struct theSvxUnoTextContentTypes :
- public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextContentTypes>
- {
- uno::Sequence<uno::Type> operator () ()
- {
- uno::Sequence< uno::Type > aTypeSequence;
-
- aTypeSequence.realloc( 11 ); // !DANGER! keep this updated
- uno::Type* pTypes = aTypeSequence.getArray();
-
- *pTypes++ = cppu::UnoType<text::XTextRange>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
- *pTypes++ = cppu::UnoType<text::XTextRangeCompare>::get();
- *pTypes++ = cppu::UnoType<text::XTextContent>::get();
- *pTypes++ = cppu::UnoType<container::XEnumerationAccess>::get();
- *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
- *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
- *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
-
- return aTypeSequence;
- }
- };
-}
-
uno::Sequence< uno::Type > SAL_CALL SvxUnoTextContent::getTypes()
{
- return theSvxUnoTextContentTypes::get();
+ static const uno::Sequence< uno::Type > TYPES {
+ cppu::UnoType<text::XTextRange>::get(),
+ cppu::UnoType<beans::XPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertyStates>::get(),
+ cppu::UnoType<beans::XPropertyState>::get(),
+ cppu::UnoType<text::XTextRangeCompare>::get(),
+ cppu::UnoType<text::XTextContent>::get(),
+ cppu::UnoType<container::XEnumerationAccess>::get(),
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ cppu::UnoType<lang::XUnoTunnel>::get() };
+ return TYPES;
}
uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextContent::getImplementationId()
@@ -501,38 +484,21 @@ void SAL_CALL SvxUnoTextCursor::release() noexcept
OWeakAggObject::release();
}
-namespace
-{
- struct theSvxUnoTextCursorTypes :
- public rtl::StaticWithInit<uno::Sequence<uno::Type>, theSvxUnoTextCursorTypes>
- {
- uno::Sequence<uno::Type> operator () ()
- {
- uno::Sequence< uno::Type > aTypeSequence;
-
- aTypeSequence.realloc( 10 ); // !DANGER! keep this updated
- uno::Type* pTypes = aTypeSequence.getArray();
-
- *pTypes++ = cppu::UnoType<text::XTextRange>::get();
- *pTypes++ = cppu::UnoType<text::XTextCursor>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertySet>::get();
- *pTypes++ = cppu::UnoType<beans::XMultiPropertyStates>::get();
- *pTypes++ = cppu::UnoType<beans::XPropertyState>::get();
- *pTypes++ = cppu::UnoType<text::XTextRangeCompare>::get();
- *pTypes++ = cppu::UnoType<lang::XServiceInfo>::get();
- *pTypes++ = cppu::UnoType<lang::XTypeProvider>::get();
- *pTypes++ = cppu::UnoType<lang::XUnoTunnel>::get();
-
- return aTypeSequence;
- }
- };
-}
-
// XTypeProvider
uno::Sequence< uno::Type > SAL_CALL SvxUnoTextCursor::getTypes()
{
- return theSvxUnoTextCursorTypes::get();
+ static const uno::Sequence< uno::Type > TYPES {
+ cppu::UnoType<text::XTextRange>::get(),
+ cppu::UnoType<text::XTextCursor>::get(),
+ cppu::UnoType<beans::XPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertySet>::get(),
+ cppu::UnoType<beans::XMultiPropertyStates>::get(),
+ cppu::UnoType<beans::XPropertyState>::get(),
+ cppu::UnoType<text::XTextRangeCompare>::get(),
+ cppu::UnoType<lang::XServiceInfo>::get(),
+ cppu::UnoType<lang::XTypeProvider>::get(),
+ cppu::UnoType<lang::XUnoTunnel>::get() };
+ return TYPES;
}
uno::Sequence< sal_Int8 > SAL_CALL SvxUnoTextCursor::getImplementationId()