From c392ecfa734731194c366e869a3c2475c53dc867 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 11 Jun 2020 14:02:57 +0300 Subject: [PATCH] Drop configurability of libnumbertext use It was fairly pointless to be able to --disable-libnumbertext. Besides, disabling it broke the ordinal page (etc) numbering feature: "1st", "2nd", "3rd", etc showed up as "Ordinal-number 1", "Ordinal-number 2", "Ordinal-number 3" etc. Change-Id: I645169054a8fdc8dac89cd48b6c369fd61749467 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/96119 Tested-by: Jenkins Reviewed-by: Tor Lillqvist --- RepositoryExternal.mk | 12 ----- config_host.mk.in | 1 - config_host/config_libnumbertext.h.in | 17 ------- configure.ac | 51 ++++++------------- .../libnumbertext/Module_libnumbertext.mk | 4 -- .../source/numbertext/numbertext.cxx | 18 +------ svl/CppunitTest_svl_qa_cppunit.mk | 6 +-- svl/qa/unit/svl.cxx | 3 -- sw/qa/extras/uiwriter/uiwriter.cxx | 7 --- 9 files changed, 19 insertions(+), 100 deletions(-) delete mode 100644 config_host/config_libnumbertext.h.in diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk index 81a65a1a8590..2255d1965382 100644 --- a/RepositoryExternal.mk +++ b/RepositoryExternal.mk @@ -830,8 +830,6 @@ endef else # !SYSTEM_LIBNUMBERTEXT -ifneq ($(ENABLE_LIBNUMBERTEXT),) - $(eval $(call gb_Helper_register_packages_for_install,ooo, \ libnumbertext_numbertext \ )) @@ -842,9 +840,6 @@ $(call gb_LinkTarget_set_include,$(1),\ -I$(call gb_UnpackedTarball_get_dir,libnumbertext/src) \ $$(INCLUDE) \ ) -$(call gb_LinkTarget_add_defs,$(1),\ - -DENABLE_LIBNUMBERTEXT \ -) ifeq ($(COM),MSC) $(call gb_LinkTarget_use_static_libraries,$(1),\ @@ -861,13 +856,6 @@ endif endef -else # !ENABLE_LIBNUMBERTEXT - -define gb_LinkTarget__use_libnumbertext -endef - -endif # ENABLE_LIBNUMBERTEXT - endif # SYSTEM_LIBNUMBERTEXT diff --git a/config_host.mk.in b/config_host.mk.in index f59b51d8f652..3f7bbb06ce60 100644 --- a/config_host.mk.in +++ b/config_host.mk.in @@ -360,7 +360,6 @@ export LIBLAYOUT_JAR=@LIBLAYOUT_JAR@ export LIBLOADER_JAR=@LIBLOADER_JAR@ export LIBNUMBERTEXT_CFLAGS=$(gb_SPACE)@LIBNUMBERTEXT_CFLAGS@ export LIBNUMBERTEXT_LIBS=$(gb_SPACE)@LIBNUMBERTEXT_LIBS@ -export ENABLE_LIBNUMBERTEXT=@ENABLE_LIBNUMBERTEXT@ export LIBO_BIN_FOLDER=@LIBO_BIN_FOLDER@ export LIBO_BIN_FOLDER_FOR_BUILD=@LIBO_BIN_FOLDER_FOR_BUILD@ export LIBO_ETC_FOLDER=@LIBO_ETC_FOLDER@ diff --git a/config_host/config_libnumbertext.h.in b/config_host/config_libnumbertext.h.in deleted file mode 100644 index de757806a104..000000000000 --- a/config_host/config_libnumbertext.h.in +++ /dev/null @@ -1,17 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - */ - -#ifndef INCLUDED_CONFIG_LIBNUMBERTEXT_H -#define INCLUDED_CONFIG_LIBNUMBERTEXT_H - -#define ENABLE_LIBNUMBERTEXT 0 - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/configure.ac b/configure.ac index 38cef8b899f2..553402e33515 100644 --- a/configure.ac +++ b/configure.ac @@ -1225,10 +1225,6 @@ libo_FUZZ_ARG_ENABLE(ooenv, AS_HELP_STRING([--disable-ooenv], [Disable ooenv for the instdir installation.])) -libo_FUZZ_ARG_ENABLE(libnumbertext, - AS_HELP_STRING([--disable-libnumbertext], - [Disable use of numbertext external library.])) - AC_ARG_ENABLE(lto, AS_HELP_STRING([--enable-lto], [Enable link-time optimization. Suitable for (optimised) product builds. Building might take @@ -10392,40 +10388,26 @@ AC_SUBST(SYSTEM_LIBEXTTEXTCAT_DATA) dnl =================================================================== dnl Checking for libnumbertext dnl =================================================================== -AC_MSG_CHECKING([whether to use libnumbertext]) -if test "$enable_libnumbertext" = "no"; then - AC_MSG_RESULT([no]) - ENABLE_LIBNUMBERTEXT= - SYSTEM_LIBNUMBERTEXT= +libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0]) +if test "$with_system_libnumbertext" = "yes"; then + SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext` + SYSTEM_LIBNUMBERTEXT=YES else - AC_MSG_RESULT([yes]) - ENABLE_LIBNUMBERTEXT=TRUE - libo_CHECK_SYSTEM_MODULE([libnumbertext],[LIBNUMBERTEXT],[libnumbertext >= 1.0.0]) - if test "$with_system_libnumbertext" = "yes"; then - SYSTEM_LIBNUMBERTEXT_DATA=file://`$PKG_CONFIG --variable=pkgdatadir libnumbertext` - SYSTEM_LIBNUMBERTEXT=YES - else - SYSTEM_LIBNUMBERTEXT= - AC_LANG_PUSH([C++]) - save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11" - AC_CHECK_HEADERS([codecvt regex]) - AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes], - [ ENABLE_LIBNUMBERTEXT='' - LIBNUMBERTEXT_CFLAGS='' - AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9). - Enable libnumbertext fallback (missing number to number name conversion).]) - ]) - CPPFLAGS=$save_CPPFLAGS - AC_LANG_POP([C++]) - fi - if test "$ENABLE_LIBNUMBERTEXT" = TRUE; then - AC_DEFINE(ENABLE_LIBNUMBERTEXT) - fi + SYSTEM_LIBNUMBERTEXT= + AC_LANG_PUSH([C++]) + save_CPPFLAGS=$CPPFLAGS + CPPFLAGS="$CPPFLAGS $CXXFLAGS_CXX11" + AC_CHECK_HEADERS([codecvt regex]) + AS_IF([test "x$ac_cv_header_codecvt" != xyes -o "x$ac_cv_header_regex" != xyes], + [ LIBNUMBERTEXT_CFLAGS='' + AC_MSG_WARN([No system-provided libnumbertext or codecvt/regex C++11 headers (min. libstdc++ 4.9). + Enable libnumbertext fallback (missing number to number name conversion).]) + ]) + CPPFLAGS=$save_CPPFLAGS + AC_LANG_POP([C++]) fi AC_SUBST(SYSTEM_LIBNUMBERTEXT) AC_SUBST(SYSTEM_LIBNUMBERTEXT_DATA) -AC_SUBST(ENABLE_LIBNUMBERTEXT) AC_SUBST(LIBNUMBERTEXT_CFLAGS) dnl *************************************** @@ -13420,7 +13402,6 @@ AC_CONFIG_HEADERS([config_host/config_langs.h]) AC_CONFIG_HEADERS([config_host/config_lgpl.h]) AC_CONFIG_HEADERS([config_host/config_libcxx.h]) AC_CONFIG_HEADERS([config_host/config_liblangtag.h]) -AC_CONFIG_HEADERS([config_host/config_libnumbertext.h]) AC_CONFIG_HEADERS([config_host/config_locales.h]) AC_CONFIG_HEADERS([config_host/config_mpl.h]) AC_CONFIG_HEADERS([config_host/config_oox.h]) diff --git a/external/libnumbertext/Module_libnumbertext.mk b/external/libnumbertext/Module_libnumbertext.mk index 1bca2233caa8..a48583e4397b 100644 --- a/external/libnumbertext/Module_libnumbertext.mk +++ b/external/libnumbertext/Module_libnumbertext.mk @@ -19,14 +19,10 @@ $(eval $(call gb_Module_add_targets,libnumbertext,\ )) else -ifeq ($(ENABLE_LIBNUMBERTEXT),TRUE) - $(eval $(call gb_Module_add_targets,libnumbertext,\ ExternalProject_libnumbertext \ )) endif -endif - # vim: set noet sw=4 ts=4: diff --git a/lingucomponent/source/numbertext/numbertext.cxx b/lingucomponent/source/numbertext/numbertext.cxx index bc13530d5250..70324c7027b2 100644 --- a/lingucomponent/source/numbertext/numbertext.cxx +++ b/lingucomponent/source/numbertext/numbertext.cxx @@ -17,7 +17,6 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include #include #include @@ -38,9 +37,7 @@ #include -#if ENABLE_LIBNUMBERTEXT #include -#endif using namespace ::osl; using namespace ::cppu; @@ -70,9 +67,7 @@ namespace { class NumberText_Impl : public ::cppu::WeakImplHelper { -#if ENABLE_LIBNUMBERTEXT Numbertext m_aNumberText; -#endif bool m_bInitialized; virtual ~NumberText_Impl() override {} @@ -118,22 +113,14 @@ void NumberText_Impl::EnsureInitialized() #else aPhysPath += "/"; #endif -#if ENABLE_LIBNUMBERTEXT OString path = OUStringToOString(aPhysPath, osl_getThreadTextEncoding()); m_aNumberText.set_prefix(path.getStr()); -#endif } -OUString SAL_CALL NumberText_Impl::getNumberText(const OUString& rText, const Locale& -#if ENABLE_LIBNUMBERTEXT - rLocale) -#else -) -#endif +OUString SAL_CALL NumberText_Impl::getNumberText(const OUString& rText, const Locale& rLocale) { osl::MutexGuard aGuard(GetNumberTextMutex()); EnsureInitialized(); -#if ENABLE_LIBNUMBERTEXT // libnumbertext supports Language + Country tags (separated by "_" or "-") LanguageTag aLanguageTag(rLocale); OUString aCode(aLanguageTag.getLanguage()); @@ -150,9 +137,6 @@ OUString SAL_CALL NumberText_Impl::getNumberText(const OUString& rText, const Lo DBG_ASSERT(result, "numbertext: false"); OString aResult2(Numbertext::wstring2string(aResult).c_str()); return OUString::fromUtf8(aResult2); -#else - return rText; -#endif } uno::Sequence SAL_CALL NumberText_Impl::getAvailableLanguages() diff --git a/svl/CppunitTest_svl_qa_cppunit.mk b/svl/CppunitTest_svl_qa_cppunit.mk index d364436eef2a..422ff5dea8b2 100644 --- a/svl/CppunitTest_svl_qa_cppunit.mk +++ b/svl/CppunitTest_svl_qa_cppunit.mk @@ -52,10 +52,8 @@ $(eval $(call gb_CppunitTest_set_include,svl_qa_cppunit,\ $(eval $(call gb_CppunitTest_use_components,svl_qa_cppunit,\ i18npool/util/i18npool \ configmgr/source/configmgr \ - $(if $(filter TRUE,$(ENABLE_LIBNUMBERTEXT)), \ - framework/util/fwk \ - lingucomponent/source/numbertext/numbertext \ - ) \ + framework/util/fwk \ + lingucomponent/source/numbertext/numbertext \ )) $(eval $(call gb_CppunitTest_use_ure,svl_qa_cppunit)) diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index 8362c9fbc88b..194dc550c278 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -8,7 +8,6 @@ */ #include -#include #include #include #include @@ -1415,7 +1414,6 @@ void Test::testUserDefinedNumberFormats() checkPreviewString(aFormatter, sCode, 120, eLang, sExpected); sCode = "[DBNum2][$-0404]General\\ "; checkPreviewString(aFormatter, sCode, 120, eLang, sExpected); -#if ENABLE_LIBNUMBERTEXT // tdf#115007 - cardinal/ordinal number names/indicators sCode = "[NatNum12]0"; sExpected = "one hundred twenty-three"; @@ -1447,7 +1445,6 @@ void Test::testUserDefinedNumberFormats() sCode = "[NatNum12 YYYY=title year, D=capitalize ordinal]D\" of \"MMMM\", \"YYYY"; sExpected = "Second of January, Nineteen Hundred"; checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected); -#endif } { // tdf#130193 tdf#130140 Native Number Formats mapping for Chinese (Traditional), Japanese, Korean // -- Traditional Chinese: DBNum1 -> NatNum4, DBNum2 -> NatNum5, DBnum3 -> NatNum3 diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index d7b01b9bbb96..6851037952fc 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -46,7 +46,6 @@ #include #include #include -#include #include #include @@ -371,9 +370,7 @@ public: void testTdf59666(); void testTdf133524(); void testTdf128860(); -#if ENABLE_LIBNUMBERTEXT void testTdf133589(); -#endif void testInconsistentBookmark(); #if HAVE_FEATURE_PDFIUM void testInsertPdf(); @@ -590,9 +587,7 @@ public: CPPUNIT_TEST(testTdf59666); CPPUNIT_TEST(testTdf133524); CPPUNIT_TEST(testTdf128860); -#if ENABLE_LIBNUMBERTEXT CPPUNIT_TEST(testTdf133589); -#endif #if HAVE_FEATURE_PDFIUM CPPUNIT_TEST(testInsertPdf); #endif @@ -7278,7 +7273,6 @@ void SwUiWriterTest::testTdf128860() CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast(pDoc->GetNodes()[nIndex])->GetText()); } -#if ENABLE_LIBNUMBERTEXT void SwUiWriterTest::testTdf133589() { #if !defined(_WIN32) @@ -7315,7 +7309,6 @@ void SwUiWriterTest::testTdf133589() CPPUNIT_ASSERT_EQUAL(sReplaced, static_cast(pDoc->GetNodes()[nIndex])->GetText()); #endif } -#endif #if HAVE_FEATURE_PDFIUM void SwUiWriterTest::testInsertPdf()