[Libreoffice-commits] core.git: sw/source
Stephan Bergmann (via logerrit)
logerrit at kemper.freedesktop.org
Sat Sep 5 15:13:21 UTC 2020
sw/source/filter/ww8/wrtww8.cxx | 32 ++------------------------------
sw/source/filter/ww8/ww8par.cxx | 4 ++--
sw/source/filter/ww8/ww8struc.hxx | 14 ++++++++++++--
3 files changed, 16 insertions(+), 34 deletions(-)
New commits:
commit 23cf849bd699427889a99301d50ad52edec9d06d
Author: Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Sat Sep 5 14:54:15 2020 +0200
Commit: Stephan Bergmann <sbergman at redhat.com>
CommitDate: Sat Sep 5 17:12:44 2020 +0200
Turn JapanNotBegin/EndLevel1 into constexpr string literals
...in preparation of further OUString improvements
Change-Id: I8e1aca3b91d2843e84755691f5f5461866c1e4e1
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102075
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman at redhat.com>
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index a0df3f50e248..85b87aa0cfab 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -550,34 +550,6 @@ static void WriteDop( WW8Export& rWrt )
rDop.Write( *rWrt.pTableStrm, *rWrt.pFib );
}
-const sal_Unicode *WW8DopTypography::GetJapanNotBeginLevel1()
-{
- static const sal_Unicode aJapanNotBeginLevel1[nMaxFollowing] =
- //Japanese Level 1
- {
- 0x0021, 0x0025, 0x0029, 0x002c, 0x002e, 0x003a, 0x003b, 0x003f,
- 0x005d, 0x007d, 0x00a2, 0x00b0, 0x2019, 0x201d, 0x2030, 0x2032,
- 0x2033, 0x2103, 0x3001, 0x3002, 0x3005, 0x3009, 0x300b, 0x300d,
- 0x300f, 0x3011, 0x3015, 0x309b, 0x309c, 0x309d, 0x309e, 0x30fb,
- 0x30fd, 0x30fe, 0xff01, 0xff05, 0xff09, 0xff0c, 0xff0e, 0xff1a,
- 0xff1b, 0xff1f, 0xff3d, 0xff5d, 0xff61, 0xff63, 0xff64, 0xff65,
- 0xff9e, 0xff9f, 0xffe0
- };
- return &aJapanNotBeginLevel1[0];
-}
-
-const sal_Unicode *WW8DopTypography::GetJapanNotEndLevel1()
-{
- static const sal_Unicode aJapanNotEndLevel1[nMaxLeading] =
- //Japanese Level 1
- {
- 0x0024, 0x0028, 0x005b, 0x005c, 0x007b, 0x00a3, 0x00a5, 0x2018,
- 0x201c, 0x3008, 0x300a, 0x300c, 0x300e, 0x3010, 0x3014, 0xff04,
- 0xff08, 0xff3b, 0xff5b, 0xff62, 0xffe1, 0xffe5
- };
- return &aJapanNotEndLevel1[0];
-}
-
static int lcl_CmpBeginEndChars( const OUString& rSWStr,
const sal_Unicode* pMSStr, int nMSStrByteLen )
{
@@ -717,14 +689,14 @@ void WW8Export::ExportDopTypography(WW8DopTypography &rTypo)
!lcl_CmpBeginEndChars
(
pForbidden->endLine,
- WW8DopTypography::GetJapanNotEndLevel1(),
+ WW8DopTypography::JapanNotEndLevel1,
WW8DopTypography::nMaxLeading * sizeof(sal_Unicode)
)
&&
!lcl_CmpBeginEndChars
(
pForbidden->beginLine,
- WW8DopTypography::GetJapanNotBeginLevel1(),
+ WW8DopTypography::JapanNotBeginLevel1,
WW8DopTypography::nMaxFollowing * sizeof(sal_Unicode)
)
)
diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx
index c77b0eef7b13..457f0410ce95 100644
--- a/sw/source/filter/ww8/ww8par.cxx
+++ b/sw/source/filter/ww8/ww8par.cxx
@@ -1993,8 +1993,8 @@ void SwWW8ImplReader::ImportDopTypography(const WW8DopTypography &rTypo)
*/
if (!rTypo.m_reserved2)
{
- i18n::ForbiddenCharacters aForbidden(WW8DopTypography::GetJapanNotBeginLevel1(),
- WW8DopTypography::GetJapanNotEndLevel1());
+ i18n::ForbiddenCharacters aForbidden(WW8DopTypography::JapanNotBeginLevel1,
+ WW8DopTypography::JapanNotEndLevel1);
m_rDoc.getIDocumentSettingAccess().setForbiddenCharacters(LANGUAGE_JAPANESE,aForbidden);
}
diff --git a/sw/source/filter/ww8/ww8struc.hxx b/sw/source/filter/ww8/ww8struc.hxx
index 8b040fc83693..f272437da648 100644
--- a/sw/source/filter/ww8/ww8struc.hxx
+++ b/sw/source/filter/ww8/ww8struc.hxx
@@ -394,8 +394,18 @@ public:
//full document, might not matter all that much though ?
enum RuleLengths {nMaxFollowing = 101, nMaxLeading = 51};
- static const sal_Unicode * GetJapanNotBeginLevel1();
- static const sal_Unicode * GetJapanNotEndLevel1();
+ static constexpr sal_Unicode JapanNotBeginLevel1[]
+ = u"\u0021\u0025\u0029\u002c\u002e\u003a\u003b\u003f"
+ "\u005d\u007d\u00a2\u00b0\u2019\u201d\u2030\u2032"
+ "\u2033\u2103\u3001\u3002\u3005\u3009\u300b\u300d"
+ "\u300f\u3011\u3015\u309b\u309c\u309d\u309e\u30fb"
+ "\u30fd\u30fe\uff01\uff05\uff09\uff0c\uff0e\uff1a"
+ "\uff1b\uff1f\uff3d\uff5d\uff61\uff63\uff64\uff65"
+ "\uff9e\uff9f\uffe0";
+ static constexpr sal_Unicode JapanNotEndLevel1[]
+ = u"\u0024\u0028\u005b\u005c\u007b\u00a3\u00a5\u2018"
+ "\u201c\u3008\u300a\u300c\u300e\u3010\u3014\uff04"
+ "\uff08\uff3b\uff5b\uff62\uffe1\uffe5";
sal_Int16 m_cchFollowingPunct; // length of rgxchFPunct
sal_Int16 m_cchLeadingPunct; // length of rgxchLPunct
More information about the Libreoffice-commits
mailing list