summaryrefslogtreecommitdiff
path: root/i18npool/inc
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2018-06-22 13:27:08 +0200
committerLuboš Luňák <l.lunak@collabora.com>2018-06-26 11:58:47 +0200
commite9430571c41367625110cdcde168da178b8b30a9 (patch)
tree4fc083a81d97087aedfb2a2e0dbd7814a3875d39 /i18npool/inc
parent364af18d7394c113dc8624c0c84de28c2747a927 (diff)
remove the useOffset thread-unsafe hack from transliteration
And instead pass it as an argument to an implementation function. Otherwise this is thread-unsafe for Calc's threaded calculation, and transliteration is used in various places in Calc code. Change-Id: Ibdf95e4b6867ec251618f6ff91e605acb69667c0 Reviewed-on: https://gerrit.libreoffice.org/56290 Tested-by: Jenkins Reviewed-by: Luboš Luňák <l.lunak@collabora.com>
Diffstat (limited to 'i18npool/inc')
-rw-r--r--i18npool/inc/textToPronounce_zh.hxx4
-rw-r--r--i18npool/inc/transliteration_Ignore.hxx20
-rw-r--r--i18npool/inc/transliteration_Numeric.hxx10
-rw-r--r--i18npool/inc/transliteration_OneToOne.hxx24
-rw-r--r--i18npool/inc/transliteration_body.hxx14
-rw-r--r--i18npool/inc/transliteration_commonclass.hxx13
6 files changed, 47 insertions, 38 deletions
diff --git a/i18npool/inc/textToPronounce_zh.hxx b/i18npool/inc/textToPronounce_zh.hxx
index d573cc1128ce..c311b8955875 100644
--- a/i18npool/inc/textToPronounce_zh.hxx
+++ b/i18npool/inc/textToPronounce_zh.hxx
@@ -41,8 +41,8 @@ public:
#endif
virtual ~TextToPronounce_zh() override;
- OUString SAL_CALL
- folding(const OUString & inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > & offset) override;
+ OUString
+ foldingImpl(const OUString & inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 > & offset, bool useOffset) override;
sal_Int16 SAL_CALL getType() override;
diff --git a/i18npool/inc/transliteration_Ignore.hxx b/i18npool/inc/transliteration_Ignore.hxx
index 6e01a3e8a1e9..4f46d10131c9 100644
--- a/i18npool/inc/transliteration_Ignore.hxx
+++ b/i18npool/inc/transliteration_Ignore.hxx
@@ -30,8 +30,8 @@ namespace i18npool {
class transliteration_Ignore : public transliteration_commonclass
{
public:
- virtual OUString SAL_CALL
- folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset) override;
+ virtual OUString
+ foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
// This method is shared.
sal_Bool SAL_CALL
@@ -46,8 +46,8 @@ public:
// Methods which are shared.
sal_Int16 SAL_CALL getType( ) override;
- OUString SAL_CALL
- transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) override;
+ OUString
+ transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
virtual sal_Unicode SAL_CALL
transliterateChar2Char( sal_Unicode inChar) override;
@@ -95,8 +95,8 @@ class ignoreDiacritics_CTL : public transliteration_Ignore
public:
ignoreDiacritics_CTL();
- OUString SAL_CALL
- folding(const OUString& rInStr, sal_Int32 nStartPos, sal_Int32 nCount, css::uno::Sequence<sal_Int32>& rOffset) override;
+ OUString
+ foldingImpl(const OUString& rInStr, sal_Int32 nStartPos, sal_Int32 nCount, css::uno::Sequence<sal_Int32>& rOffset, bool useOffset) override;
sal_Unicode SAL_CALL
transliterateChar2Char(sal_Unicode nInChar) override;
@@ -114,8 +114,8 @@ public:\
transliterationName = "ignore"#name;\
implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\
};\
- OUString SAL_CALL folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \
- css::uno::Sequence< sal_Int32 >& offset) override; \
+ OUString foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \
+ css::uno::Sequence< sal_Int32 >& offset, bool useOffset) override; \
};
TRANSLITERATION_IGNORE(KiKuFollowedBySa_ja_JP)
@@ -135,8 +135,8 @@ public:\
transliterationName = "ignore"#name;\
implementationName = "com.sun.star.i18n.Transliteration.ignore"#name;\
};\
- OUString SAL_CALL folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \
- css::uno::Sequence< sal_Int32 >& offset) override; \
+ OUString foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, \
+ css::uno::Sequence< sal_Int32 >& offset, bool useOffset) override; \
using transliteration_Ignore::transliterateRange;\
css::uno::Sequence< OUString > SAL_CALL transliterateRange( const OUString& str1, \
const OUString& str2 ) override; \
diff --git a/i18npool/inc/transliteration_Numeric.hxx b/i18npool/inc/transliteration_Numeric.hxx
index b1ab5b423dbf..8ebf2a394a4a 100644
--- a/i18npool/inc/transliteration_Numeric.hxx
+++ b/i18npool/inc/transliteration_Numeric.hxx
@@ -25,8 +25,8 @@ namespace i18npool {
class transliteration_Numeric : public transliteration_commonclass {
public:
- virtual OUString SAL_CALL
- transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) override;
+ virtual OUString
+ transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
virtual sal_Unicode SAL_CALL
transliterateChar2Char( sal_Unicode inChar) override;
@@ -34,8 +34,8 @@ public:
// Methods which are shared.
virtual sal_Int16 SAL_CALL getType( ) override;
- virtual OUString SAL_CALL
- folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) override;
+ virtual OUString
+ foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
virtual sal_Bool SAL_CALL
equals( const OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1, const OUString& str2, sal_Int32 pos2, sal_Int32 nCount2, sal_Int32& nMatch2 ) override;
@@ -51,7 +51,7 @@ private:
/// @throws css::uno::RuntimeException
OUString
transliterateBullet( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
- css::uno::Sequence< sal_Int32 >& offset );
+ css::uno::Sequence< sal_Int32 >& offset, bool useOffset );
};
}
diff --git a/i18npool/inc/transliteration_OneToOne.hxx b/i18npool/inc/transliteration_OneToOne.hxx
index e87ef1ed93df..ae594e754377 100644
--- a/i18npool/inc/transliteration_OneToOne.hxx
+++ b/i18npool/inc/transliteration_OneToOne.hxx
@@ -29,8 +29,8 @@ typedef sal_Unicode (*TransFunc)(const sal_Unicode);
class transliteration_OneToOne : public transliteration_commonclass
{
public:
- OUString SAL_CALL
- transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) override;
+ OUString
+ transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
sal_Unicode SAL_CALL
transliterateChar2Char( sal_Unicode inChar) override;
@@ -38,8 +38,8 @@ public:
// Methods which are shared.
sal_Int16 SAL_CALL getType() override;
- OUString SAL_CALL
- folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset) override;
+ OUString
+ foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
sal_Bool SAL_CALL
equals( const OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1,
@@ -58,8 +58,8 @@ class name : public transliteration_OneToOne \
{ \
public: \
name (); \
- OUString SAL_CALL \
- transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) \
+ OUString \
+ transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) \
override; \
sal_Unicode SAL_CALL \
transliterateChar2Char( sal_Unicode inChar) \
@@ -74,22 +74,22 @@ class halfwidthToFullwidth : public transliteration_OneToOne
{
public:
halfwidthToFullwidth();
- OUString SAL_CALL
- transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) override;
+ OUString
+ transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
};
class halfwidthKatakanaToFullwidthKatakana : public transliteration_OneToOne
{
public:
halfwidthKatakanaToFullwidthKatakana();
- OUString SAL_CALL
- transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) override;
+ OUString
+ transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
};
class halfwidthToFullwidthLikeJIS : public transliteration_OneToOne
{
public:
halfwidthToFullwidthLikeJIS();
- OUString SAL_CALL
- transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) override;
+ OUString
+ transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
};
#undef TRANSLITERATION_ONETOONE
diff --git a/i18npool/inc/transliteration_body.hxx b/i18npool/inc/transliteration_body.hxx
index 5e9d2d7971ba..5476cc841454 100644
--- a/i18npool/inc/transliteration_body.hxx
+++ b/i18npool/inc/transliteration_body.hxx
@@ -32,8 +32,8 @@ public:
// Methods which are shared.
sal_Int16 SAL_CALL getType() override;
- OUString SAL_CALL transliterate(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
- css::uno::Sequence< sal_Int32 >& offset) override;
+ OUString transliterateImpl(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
+ css::uno::Sequence< sal_Int32 >& offset, bool useOffset) override;
OUString SAL_CALL
transliterateChar2String( sal_Unicode inChar) override;
@@ -41,8 +41,8 @@ public:
virtual sal_Unicode SAL_CALL
transliterateChar2Char( sal_Unicode inChar) override;
- OUString SAL_CALL folding(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
- css::uno::Sequence< sal_Int32 >& offset) override;
+ OUString foldingImpl(const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
+ css::uno::Sequence< sal_Int32 >& offset, bool useOffset) override;
sal_Bool SAL_CALL equals(
const OUString& str1, sal_Int32 pos1, sal_Int32 nCount1, sal_Int32& nMatch1,
@@ -85,7 +85,8 @@ class Transliteration_titlecase : public Transliteration_body
public:
Transliteration_titlecase();
- virtual OUString SAL_CALL transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) override;
+ virtual OUString transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
+ css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
};
class Transliteration_sentencecase : public Transliteration_body
@@ -93,7 +94,8 @@ class Transliteration_sentencecase : public Transliteration_body
public:
Transliteration_sentencecase();
- virtual OUString SAL_CALL transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) override;
+ virtual OUString transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount,
+ css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) override;
};
}
diff --git a/i18npool/inc/transliteration_commonclass.hxx b/i18npool/inc/transliteration_commonclass.hxx
index ebf3dc4b60a4..48d6688df36f 100644
--- a/i18npool/inc/transliteration_commonclass.hxx
+++ b/i18npool/inc/transliteration_commonclass.hxx
@@ -58,10 +58,12 @@ public:
virtual sal_Int16 SAL_CALL getType( ) override = 0;
virtual OUString SAL_CALL
- transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) override = 0;
+ transliterate( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset ) override final
+ { return transliterateImpl( inStr, startPos, nCount, offset, true ); }
virtual OUString SAL_CALL
- folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset) override = 0;
+ folding( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset) override final
+ { return foldingImpl( inStr, startPos, nCount, offset, true ); }
// Methods in XExtendedTransliteration
virtual OUString SAL_CALL
@@ -88,10 +90,15 @@ public:
virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override;
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
protected:
+ virtual OUString
+ transliterateImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) = 0;
+
+ virtual OUString
+ foldingImpl( const OUString& inStr, sal_Int32 startPos, sal_Int32 nCount, css::uno::Sequence< sal_Int32 >& offset, bool useOffset ) = 0;
+
css::lang::Locale aLocale;
const sal_Char* transliterationName;
const sal_Char* implementationName;
- bool useOffset;
};
}