[Libreoffice-commits] .: 2 commits - basic/inc basic/Library_sb.mk basic/Package_inc.mk basic/source

Markus Mohrhard mmohrhard at kemper.freedesktop.org
Fri Feb 10 14:03:07 PST 2012


 basic/Library_sb.mk             |    1 
 basic/Package_inc.mk            |    1 
 basic/inc/basic/global.hxx      |   45 ++++++++++++++++++++++++++++++++++++
 basic/source/basmgr/basmgr.cxx  |    8 +++---
 basic/source/classes/global.cxx |   50 ++++++++++++++++++++++++++++++++++++++++
 5 files changed, 101 insertions(+), 4 deletions(-)

New commits:
commit da39d1443c03da64fe64a1862cdc36246e19d6aa
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Feb 10 22:50:27 2012 +0100

    use TransliterationWrapper in lcl_queryMacro, fdo#45607

diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx
index df20c20..83000b8 100644
--- a/basic/source/basmgr/basmgr.cxx
+++ b/basic/source/basmgr/basmgr.cxx
@@ -46,6 +46,7 @@
 
 #include <basic/sbuno.hxx>
 #include <basic/basmgr.hxx>
+#include <basic/global.hxx>
 #include <sbunoobj.hxx>
 #include "basrid.hxx"
 #include "sbintern.hxx"
@@ -1736,12 +1737,11 @@ namespace
         String sModule = sMacro.GetToken( 0, '.', nLast );
         sMacro.Erase( 0, nLast );
 
-        IntlWrapper aIntlWrapper( ::comphelper::getProcessServiceFactory(), Application::GetSettings().GetLocale() );
-        const CollatorWrapper* pCollator = aIntlWrapper.getCollator();
+        utl::TransliterationWrapper* pTransliteration = SbGlobal::GetTransliteration();
         sal_uInt16 nLibCount = i_manager->GetLibCount();
         for ( sal_uInt16 nLib = 0; nLib < nLibCount; ++nLib )
         {
-            if ( COMPARE_EQUAL == pCollator->compareString( i_manager->GetLibName( nLib ), sLibName ) )
+            if ( pTransliteration->isEqual( i_manager->GetLibName( nLib ), sLibName ) )
             {
                 StarBASIC* pLib = i_manager->GetLib( nLib );
                 if( !pLib )
@@ -1756,7 +1756,7 @@ namespace
                     for( sal_uInt16 nMod = 0; nMod < nModCount; ++nMod )
                     {
                         SbModule* pMod = (SbModule*)pLib->GetModules()->Get( nMod );
-                        if ( pMod && COMPARE_EQUAL == pCollator->compareString( pMod->GetName(), sModule ) )
+                        if ( pMod && pTransliteration->isEqual( pMod->GetName(), sModule ) )
                         {
                             SbMethod* pMethod = (SbMethod*)pMod->Find( sMacro, SbxCLASS_METHOD );
                             if( pMethod )
commit 05d48fb71f85af3bd66ff1156b71f8d95ea7a411
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Fri Feb 10 22:12:03 2012 +0100

    add SbGlobal for shared static objects

diff --git a/basic/Library_sb.mk b/basic/Library_sb.mk
index 04dad27..0171682 100644
--- a/basic/Library_sb.mk
+++ b/basic/Library_sb.mk
@@ -70,6 +70,7 @@ $(eval $(call gb_Library_add_exception_objects,sb,\
 	basic/source/basmgr/vbahelper \
 	basic/source/classes/errobject \
 	basic/source/classes/eventatt \
+	basic/source/classes/global \
 	basic/source/classes/image \
 	basic/source/classes/propacc \
 	basic/source/classes/sb \
diff --git a/basic/Package_inc.mk b/basic/Package_inc.mk
index 603e694..1b1da04 100644
--- a/basic/Package_inc.mk
+++ b/basic/Package_inc.mk
@@ -44,6 +44,7 @@ $(eval $(call gb_Package_add_file,basic_inc,inc/basic/sbxdef.hxx,basic/sbxdef.hx
 $(eval $(call gb_Package_add_file,basic_inc,inc/basic/sbxfac.hxx,basic/sbxfac.hxx))
 $(eval $(call gb_Package_add_file,basic_inc,inc/basic/sbxform.hxx,basic/sbxform.hxx))
 $(eval $(call gb_Package_add_file,basic_inc,inc/basic/sbx.hxx,basic/sbx.hxx))
+$(eval $(call gb_Package_add_file,basic_inc,inc/basic/global.hxx,basic/global.hxx))
 $(eval $(call gb_Package_add_file,basic_inc,inc/basic/sbxmeth.hxx,basic/sbxmeth.hxx))
 $(eval $(call gb_Package_add_file,basic_inc,inc/basic/sbxobj.hxx,basic/sbxobj.hxx))
 $(eval $(call gb_Package_add_file,basic_inc,inc/basic/sbxprop.hxx,basic/sbxprop.hxx))
diff --git a/basic/inc/basic/global.hxx b/basic/inc/basic/global.hxx
new file mode 100644
index 0000000..75c5d62
--- /dev/null
+++ b/basic/inc/basic/global.hxx
@@ -0,0 +1,45 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard at googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#ifndef BASIC_SBGLOBAL_HXX
+#define BASIC_SBGLOBAL_HXX
+
+namespace utl {
+    class TransliterationWrapper;
+}
+
+class SbGlobal
+{
+    static utl::TransliterationWrapper* pTransliteration;
+public:
+    static utl::TransliterationWrapper* GetTransliteration();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/basic/source/classes/global.cxx b/basic/source/classes/global.cxx
new file mode 100644
index 0000000..023ed85
--- /dev/null
+++ b/basic/source/classes/global.cxx
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2012 Markus Mohrhard <markus.mohrhard at googlemail.com> (initial developer)
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include "basic/global.hxx"
+#include <unotools/transliterationwrapper.hxx>
+#include <comphelper/processfactory.hxx>
+#include <i18npool/lang.h>
+#include <vcl/svapp.hxx>
+
+utl::TransliterationWrapper* SbGlobal::pTransliteration = NULL;
+
+utl::TransliterationWrapper* SbGlobal::GetTransliteration()
+{
+    if(!pTransliteration)
+    {
+        const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage();
+        pTransliteration = new ::utl::TransliterationWrapper(
+            comphelper::getProcessServiceFactory(),
+            com::sun::star::i18n::TransliterationModules_IGNORE_CASE );
+            pTransliteration->loadModuleIfNeeded( eOfficeLanguage );
+    }
+    return pTransliteration;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list