diff options
-rw-r--r-- | i18npool/Library_i18npool.mk | 2 | ||||
-rw-r--r-- | i18npool/inc/unoscripttypedetector.hxx (renamed from i18npool/inc/scripttypedetector.hxx) | 11 | ||||
-rw-r--r-- | i18npool/source/characterclassification/unoscripttypedetector.cxx | 97 | ||||
-rw-r--r-- | i18npool/source/registerservices/registerservices.cxx | 6 | ||||
-rw-r--r-- | i18nutil/Library_i18nutil.mk | 1 | ||||
-rw-r--r-- | i18nutil/Package_inc.mk | 1 | ||||
-rw-r--r-- | i18nutil/inc/i18nutil/scripttypedetector.hxx | 47 | ||||
-rw-r--r-- | i18nutil/source/utility/scripttypedetector.cxx (renamed from i18npool/source/characterclassification/scripttypedetector.cxx) | 55 | ||||
-rw-r--r-- | sd/CppunitTest_sd_filters_test.mk | 1 | ||||
-rw-r--r-- | sd/Library_sdfilt.mk | 1 | ||||
-rw-r--r-- | sd/source/filter/eppt/epptbase.hxx | 2 | ||||
-rw-r--r-- | sd/source/filter/eppt/pptx-text.cxx | 26 | ||||
-rw-r--r-- | sw/inc/breakit.hxx | 8 | ||||
-rw-r--r-- | sw/source/core/bastyp/breakit.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/text/porlay.cxx | 11 |
15 files changed, 179 insertions, 97 deletions
diff --git a/i18npool/Library_i18npool.mk b/i18npool/Library_i18npool.mk index 3faaa6ae05bd..9b56c5c1725b 100644 --- a/i18npool/Library_i18npool.mk +++ b/i18npool/Library_i18npool.mk @@ -79,7 +79,7 @@ $(eval $(call gb_Library_add_exception_objects,i18npool,\ i18npool/source/characterclassification/cclass_unicode \ i18npool/source/characterclassification/cclass_unicode_parser \ i18npool/source/characterclassification/characterclassificationImpl \ - i18npool/source/characterclassification/scripttypedetector \ + i18npool/source/characterclassification/unoscripttypedetector \ i18npool/source/collator/chaptercollator \ i18npool/source/collator/collatorImpl \ i18npool/source/collator/collator_unicode \ diff --git a/i18npool/inc/scripttypedetector.hxx b/i18npool/inc/unoscripttypedetector.hxx index 301dd6d51a6c..ce06105382d3 100644 --- a/i18npool/inc/scripttypedetector.hxx +++ b/i18npool/inc/unoscripttypedetector.hxx @@ -25,8 +25,8 @@ * for a copy of the LGPLv3 License. * ************************************************************************/ -#ifndef _I18N_SCRIPTTYPEDETECTOR_HXX_ -#define _I18N_SCRIPTTYPEDETECTOR_HXX_ +#ifndef _I18N_UNOSCRIPTTYPEDETECTOR_HXX_ +#define _I18N_UNOSCRIPTTYPEDETECTOR_HXX_ #include <com/sun/star/lang/XServiceInfo.hpp> @@ -34,18 +34,15 @@ #include <cppuhelper/implbase2.hxx> // helper for implementations // ---------------------------------------------------- -// class ScriptTypeDetector +// class UnoScriptTypeDetector // ---------------------------------------------------- -class ScriptTypeDetector : public cppu::WeakImplHelper2 +class UnoScriptTypeDetector : public cppu::WeakImplHelper2 < ::com::sun::star::i18n::XScriptTypeDetector, ::com::sun::star::lang::XServiceInfo > { public: - ScriptTypeDetector(); - virtual ~ScriptTypeDetector(); - // Methods virtual sal_Int32 SAL_CALL beginOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection ) throw (::com::sun::star::uno::RuntimeException); virtual sal_Int32 SAL_CALL endOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection ) throw (::com::sun::star::uno::RuntimeException); diff --git a/i18npool/source/characterclassification/unoscripttypedetector.cxx b/i18npool/source/characterclassification/unoscripttypedetector.cxx new file mode 100644 index 000000000000..879d2a22757b --- /dev/null +++ b/i18npool/source/characterclassification/unoscripttypedetector.cxx @@ -0,0 +1,97 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#include "unoscripttypedetector.hxx" +#include <i18nutil/scripttypedetector.hxx> + +// ---------------------------------------------------- +// class UnoScriptTypeDetector +// ----------------------------------------------------; + +sal_Int16 SAL_CALL +UnoScriptTypeDetector::getScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection ) throw (::com::sun::star::uno::RuntimeException) +{ + return ScriptTypeDetector::getScriptDirection(Text, nPos, defaultScriptDirection); +} + +// return value '-1' means either the direction on nPos is not same as scriptDirection or nPos is out of range. +sal_Int32 SAL_CALL +UnoScriptTypeDetector::beginOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 direction ) throw (::com::sun::star::uno::RuntimeException) +{ + return ScriptTypeDetector::beginOfScriptDirection(Text, nPos, direction); +} + +sal_Int32 SAL_CALL +UnoScriptTypeDetector::endOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 direction ) throw (::com::sun::star::uno::RuntimeException) +{ + return ScriptTypeDetector::endOfScriptDirection(Text, nPos, direction); +} + +sal_Int16 SAL_CALL +UnoScriptTypeDetector::getCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException) +{ + return ScriptTypeDetector::getCTLScriptType(Text, nPos); +} + +// Begin of Script Type is inclusive. +sal_Int32 SAL_CALL +UnoScriptTypeDetector::beginOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException) +{ + return ScriptTypeDetector::beginOfCTLScriptType(Text, nPos); +} + +// End of the Script Type is exclusive, the return value pointing to the begin of next script type +sal_Int32 SAL_CALL +UnoScriptTypeDetector::endOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException) +{ + return ScriptTypeDetector::endOfCTLScriptType(Text, nPos); +} + +const sal_Char sDetector[] = "draft.com.sun.star.i18n.UnoScriptTypeDetector"; + +rtl::OUString SAL_CALL +UnoScriptTypeDetector::getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) +{ + return rtl::OUString(sDetector); +} + +sal_Bool SAL_CALL +UnoScriptTypeDetector::supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ) +{ + return ServiceName != sDetector; +} + +::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL +UnoScriptTypeDetector::getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ) +{ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aRet(1); + aRet[0] = sDetector; + return aRet; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index 1c061a1762a8..fe488bfad4a3 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -71,7 +71,7 @@ #define CCLASS_ALL #include <characterclassificationImpl.hxx> -#include <scripttypedetector.hxx> +#include <unoscripttypedetector.hxx> #include <cclass_unicode.hxx> #define COLLATOR_ALL @@ -157,7 +157,7 @@ IMPL_CREATEINSTANCE( Collator_Unicode ) IMPL_CREATEINSTANCE_MSF( CharacterClassificationImpl ) IMPL_CREATEINSTANCE_MSF( cclass_Unicode ) IMPL_CREATEINSTANCE_MSF( TransliterationImpl ) -IMPL_CREATEINSTANCE( ScriptTypeDetector ) +IMPL_CREATEINSTANCE( UnoScriptTypeDetector ) IMPL_CREATEINSTANCE_MSF( InputSequenceCheckerImpl ) IMPL_CREATEINSTANCE( InputSequenceChecker_th ) @@ -388,7 +388,7 @@ static const struct InstancesArray { &Collator_Unicode_CreateInstance }, { "com.sun.star.i18n.ScriptTypeDetector", "com.sun.star.i18n.ScriptTypeDetector", - &ScriptTypeDetector_CreateInstance }, + &UnoScriptTypeDetector_CreateInstance }, { "com.sun.star.i18n.CharacterClassification", "com.sun.star.i18n.CharacterClassification", &CharacterClassificationImpl_CreateInstance }, diff --git a/i18nutil/Library_i18nutil.mk b/i18nutil/Library_i18nutil.mk index e3de16e7244f..a05c3d017f89 100644 --- a/i18nutil/Library_i18nutil.mk +++ b/i18nutil/Library_i18nutil.mk @@ -48,6 +48,7 @@ $(eval $(call gb_Library_add_linked_libs,i18nutil,\ $(eval $(call gb_Library_add_exception_objects,i18nutil,\ i18nutil/source/utility/casefolding \ i18nutil/source/utility/oneToOneMapping \ + i18nutil/source/utility/scripttypedetector \ i18nutil/source/utility/unicode \ i18nutil/source/utility/widthfolding \ )) diff --git a/i18nutil/Package_inc.mk b/i18nutil/Package_inc.mk index 92a9e71de50c..3ea2b55d46be 100644 --- a/i18nutil/Package_inc.mk +++ b/i18nutil/Package_inc.mk @@ -30,6 +30,7 @@ $(eval $(call gb_Package_Package,i18nutil_inc,$(SRCDIR)/i18nutil/inc)) $(eval $(call gb_Package_add_file,i18nutil_inc,inc/i18nutil/i18nutildllapi.h,i18nutil/i18nutildllapi.h)) $(eval $(call gb_Package_add_file,i18nutil_inc,inc/i18nutil/casefolding.hxx,i18nutil/casefolding.hxx)) $(eval $(call gb_Package_add_file,i18nutil_inc,inc/i18nutil/oneToOneMapping.hxx,i18nutil/oneToOneMapping.hxx)) +$(eval $(call gb_Package_add_file,i18nutil_inc,inc/i18nutil/scripttypedetector.hxx,i18nutil/scripttypedetector.hxx)) $(eval $(call gb_Package_add_file,i18nutil_inc,inc/i18nutil/unicode.hxx,i18nutil/unicode.hxx)) $(eval $(call gb_Package_add_file,i18nutil_inc,inc/i18nutil/widthfolding.hxx,i18nutil/widthfolding.hxx)) diff --git a/i18nutil/inc/i18nutil/scripttypedetector.hxx b/i18nutil/inc/i18nutil/scripttypedetector.hxx new file mode 100644 index 000000000000..9b732ef21353 --- /dev/null +++ b/i18nutil/inc/i18nutil/scripttypedetector.hxx @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ +#ifndef _I18N_SCRIPTTYPEDETECTOR_HXX_ +#define _I18N_SCRIPTTYPEDETECTOR_HXX_ + +#include "i18nutildllapi.h" +#include <rtl/ustring.hxx> + +class I18NUTIL_DLLPUBLIC ScriptTypeDetector +{ +public: + static sal_Int32 beginOfScriptDirection( const rtl::OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection ); + static sal_Int32 endOfScriptDirection( const rtl::OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection ); + static sal_Int16 getScriptDirection( const rtl::OUString& Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection ); + static sal_Int32 beginOfCTLScriptType( const rtl::OUString& Text, sal_Int32 nPos ); + static sal_Int32 endOfCTLScriptType( const rtl::OUString& Text, sal_Int32 nPos ); + static sal_Int16 getCTLScriptType( const rtl::OUString& Text, sal_Int32 nPos ); +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/i18npool/source/characterclassification/scripttypedetector.cxx b/i18nutil/source/utility/scripttypedetector.cxx index 28f5165ebc77..1c70f5e155f5 100644 --- a/i18npool/source/characterclassification/scripttypedetector.cxx +++ b/i18nutil/source/utility/scripttypedetector.cxx @@ -26,27 +26,14 @@ * ************************************************************************/ - #include <com/sun/star/i18n/CTLScriptType.hpp> #include <com/sun/star/i18n/ScriptDirection.hpp> #include <com/sun/star/i18n/UnicodeScript.hpp> -#include <scripttypedetector.hxx> +#include <i18nutil/scripttypedetector.hxx> #include <i18nutil/unicode.hxx> -// ---------------------------------------------------- -// class ScriptTypeDetector -// ----------------------------------------------------; - using namespace com::sun::star::i18n; -ScriptTypeDetector::ScriptTypeDetector() -{ -} - -ScriptTypeDetector::~ScriptTypeDetector() -{ -} - static sal_Int16 scriptDirection[] = { ScriptDirection::LEFT_TO_RIGHT, // DirectionProperty_LEFT_TO_RIGHT = 0, ScriptDirection::RIGHT_TO_LEFT, // DirectionProperty_RIGHT_TO_LEFT = 1, @@ -69,16 +56,14 @@ static sal_Int16 scriptDirection[] = { ScriptDirection::NEUTRAL, // DirectionProperty_BOUNDARY_NEUTRAL = 18, }; -sal_Int16 SAL_CALL -ScriptTypeDetector::getScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection ) throw (::com::sun::star::uno::RuntimeException) +sal_Int16 ScriptTypeDetector::getScriptDirection( const rtl::OUString& Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection ) { sal_Int16 dir = scriptDirection[unicode::getUnicodeDirection(Text[nPos])]; return (dir == ScriptDirection::NEUTRAL) ? defaultScriptDirection : dir; } // return value '-1' means either the direction on nPos is not same as scriptDirection or nPos is out of range. -sal_Int32 SAL_CALL -ScriptTypeDetector::beginOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 direction ) throw (::com::sun::star::uno::RuntimeException) +sal_Int32 ScriptTypeDetector::beginOfScriptDirection( const rtl::OUString& Text, sal_Int32 nPos, sal_Int16 direction ) { sal_Int32 cPos = nPos; @@ -91,8 +76,7 @@ ScriptTypeDetector::beginOfScriptDirection( const ::rtl::OUString& Text, sal_Int return cPos == nPos ? -1 : cPos + 1; } -sal_Int32 SAL_CALL -ScriptTypeDetector::endOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 direction ) throw (::com::sun::star::uno::RuntimeException) +sal_Int32 ScriptTypeDetector::endOfScriptDirection( const rtl::OUString& Text, sal_Int32 nPos, sal_Int16 direction ) { sal_Int32 cPos = nPos; sal_Int32 len = Text.getLength(); @@ -106,8 +90,7 @@ ScriptTypeDetector::endOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 return cPos == nPos ? -1 : cPos; } -sal_Int16 SAL_CALL -ScriptTypeDetector::getCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException) +sal_Int16 ScriptTypeDetector::getCTLScriptType( const rtl::OUString& Text, sal_Int32 nPos ) { static ScriptTypeList typeList[] = { { UnicodeScript_kHebrew, UnicodeScript_kHebrew, CTLScriptType::CTL_HEBREW }, // 10 @@ -121,8 +104,7 @@ ScriptTypeDetector::getCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPo } // Begin of Script Type is inclusive. -sal_Int32 SAL_CALL -ScriptTypeDetector::beginOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException) +sal_Int32 ScriptTypeDetector::beginOfCTLScriptType( const rtl::OUString& Text, sal_Int32 nPos ) { if (nPos < 0) return 0; @@ -139,8 +121,7 @@ ScriptTypeDetector::beginOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 } // End of the Script Type is exclusive, the return value pointing to the begin of next script type -sal_Int32 SAL_CALL -ScriptTypeDetector::endOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException) +sal_Int32 ScriptTypeDetector::endOfCTLScriptType( const rtl::OUString& Text, sal_Int32 nPos ) { if (nPos < 0) return 0; @@ -157,26 +138,4 @@ ScriptTypeDetector::endOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 n } } -const sal_Char sDetector[] = "draft.com.sun.star.i18n.ScriptTypeDetector"; - -rtl::OUString SAL_CALL -ScriptTypeDetector::getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) -{ - return rtl::OUString(sDetector); -} - -sal_Bool SAL_CALL -ScriptTypeDetector::supportsService(const rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ) -{ - return ServiceName != sDetector; -} - -::com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL -ScriptTypeDetector::getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ) -{ - ::com::sun::star::uno::Sequence< ::rtl::OUString > aRet(1); - aRet[0] = sDetector; - return aRet; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sd/CppunitTest_sd_filters_test.mk b/sd/CppunitTest_sd_filters_test.mk index 193343952c78..647c45c1cd3b 100644 --- a/sd/CppunitTest_sd_filters_test.mk +++ b/sd/CppunitTest_sd_filters_test.mk @@ -43,6 +43,7 @@ $(eval $(call gb_CppunitTest_add_linked_libs,sd_filters_test, \ editeng \ fileacc \ i18nisolang1 \ + i18nutil \ msfilter \ oox \ sal \ diff --git a/sd/Library_sdfilt.mk b/sd/Library_sdfilt.mk index b3e74ffddb93..585dc9e0451d 100644 --- a/sd/Library_sdfilt.mk +++ b/sd/Library_sdfilt.mk @@ -53,6 +53,7 @@ $(eval $(call gb_Library_add_linked_libs,sdfilt,\ cppuhelper \ editeng \ i18nisolang1 \ + i18nutil \ msfilter \ oox \ sal \ diff --git a/sd/source/filter/eppt/epptbase.hxx b/sd/source/filter/eppt/epptbase.hxx index 33a43d364fd7..c2bb4e31189e 100644 --- a/sd/source/filter/eppt/epptbase.hxx +++ b/sd/source/filter/eppt/epptbase.hxx @@ -190,7 +190,7 @@ public : ~FontCollection(); - short GetScriptDirection( const String& rText ) const; + short GetScriptDirection( const rtl::OUString& rText ) const; sal_uInt32 GetId( FontCollectionEntry& rFontDescriptor ); diff --git a/sd/source/filter/eppt/pptx-text.cxx b/sd/source/filter/eppt/pptx-text.cxx index 38485286f9aa..e53b0c2230a9 100644 --- a/sd/source/filter/eppt/pptx-text.cxx +++ b/sd/source/filter/eppt/pptx-text.cxx @@ -37,7 +37,6 @@ #include <com/sun/star/i18n/XBreakIterator.hpp> #include <com/sun/star/i18n/ScriptDirection.hpp> #include <com/sun/star/i18n/ScriptType.hpp> -#include <com/sun/star/i18n/XScriptTypeDetector.hpp> #include <com/sun/star/text/FontRelief.hpp> #include <com/sun/star/text/XTextField.hpp> #include <com/sun/star/text/XTextRange.hpp> @@ -46,19 +45,19 @@ #include <com/sun/star/style/ParagraphAdjust.hpp> #include <com/sun/star/style/TabStop.hpp> -#include <svl/languageoptions.hxx> -#include <sfx2/app.hxx> +#include <comphelper/processfactory.hxx> #include <editeng/svxenum.hxx> #include <editeng/frmdir.hxx> +#include <i18nutil/scripttypedetector.hxx> +#include <sfx2/app.hxx> +#include <svl/languageoptions.hxx> +#include <oox/export/drawingml.hxx> // for SubstituteBullet #include <unotools/fontcvt.hxx> #include <vcl/metric.hxx> #include <vcl/outdev.hxx> #include <vcl/virdev.hxx> -#include <comphelper/processfactory.hxx> -#include <oox/export/drawingml.hxx> // for SubstituteBullet com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > xPPTBreakIter; -com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > xScriptTypeDetector; PortionObj::PortionObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet, FontCollection& rFontCollection ) : @@ -1339,7 +1338,6 @@ FontCollection::~FontCollection() { delete pVDev; xPPTBreakIter = NULL; - xScriptTypeDetector = NULL; } FontCollection::FontCollection() : @@ -1352,21 +1350,11 @@ FontCollection::FontCollection() : if ( xInterface.is() ) xPPTBreakIter = com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > ( xInterface, com::sun::star::uno::UNO_QUERY ); - - xInterface = xMSF->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.ScriptTypeDetector" ) ) ); - if ( xInterface.is() ) - xScriptTypeDetector = com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > - ( xInterface, com::sun::star::uno::UNO_QUERY ); } -short FontCollection::GetScriptDirection( const String& rString ) const +short FontCollection::GetScriptDirection( const rtl::OUString& rString ) const { - short nRet = com::sun::star::i18n::ScriptDirection::NEUTRAL; - if ( xScriptTypeDetector.is() ) - { - const rtl::OUString sT( rString ); - nRet = xScriptTypeDetector->getScriptDirection( sT, 0, com::sun::star::i18n::ScriptDirection::NEUTRAL ); - } + short nRet = ScriptTypeDetector::getScriptDirection( rString, 0, com::sun::star::i18n::ScriptDirection::NEUTRAL ); return nRet; } diff --git a/sw/inc/breakit.hxx b/sw/inc/breakit.hxx index 05f4d9a8cb2c..34ae144d88a4 100644 --- a/sw/inc/breakit.hxx +++ b/sw/inc/breakit.hxx @@ -49,8 +49,6 @@ class SW_DLLPUBLIC SwBreakIt { com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMSF; mutable com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > xBreak; - com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > xCTLDetect; - com::sun::star::lang::Locale * m_pLocale; com::sun::star::i18n::ForbiddenCharacters * m_pForbidden; @@ -89,12 +87,6 @@ public: return xBreak; } - com::sun::star::uno::Reference< com::sun::star::i18n::XScriptTypeDetector > GetScriptTypeDetector() - { - createScriptTypeDetector(); - return xCTLDetect; - } - const com::sun::star::lang::Locale& GetLocale( const LanguageType aLang ) { if( !m_pLocale || aLast != aLang ) diff --git a/sw/source/core/bastyp/breakit.cxx b/sw/source/core/bastyp/breakit.cxx index bb9366023b7a..9b4476fa4d59 100644 --- a/sw/source/core/bastyp/breakit.cxx +++ b/sw/source/core/bastyp/breakit.cxx @@ -74,16 +74,13 @@ SwBreakIt::~SwBreakIt() delete m_pLocale; delete m_pForbidden; } + void SwBreakIt::createBreakIterator() const { if ( m_xMSF.is() && !xBreak.is() ) xBreak.set(m_xMSF->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator"))),uno::UNO_QUERY); } -void SwBreakIt::createScriptTypeDetector() -{ - if ( m_xMSF.is() && !xCTLDetect.is() ) - xCTLDetect.set(m_xMSF->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.ScriptTypeDetector" ))),uno::UNO_QUERY); -} + void SwBreakIt::_GetLocale( const LanguageType aLang ) { aLast = aLang; diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx index ac773c5758a1..7f0e3874d01b 100644 --- a/sw/source/core/text/porlay.cxx +++ b/sw/source/core/text/porlay.cxx @@ -64,7 +64,8 @@ using namespace ::com::sun::star; using namespace i18n::ScriptType; #include <unicode/ubidi.h> -#include <i18nutil/unicode.hxx> //unicode::getUnicodeScriptType +#include <i18nutil/scripttypedetector.hxx> +#include <i18nutil/unicode.hxx> #define IS_JOINING_GROUP(c, g) ( u_getIntPropertyValue( (c), UCHAR_JOINING_GROUP ) == U_JG_##g ) #define isAinChar(c) IS_JOINING_GROUP((c), AIN) @@ -904,16 +905,16 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) // #i28203# // for 'complex' portions, we make sure that a portion does not contain more // than one script: - if( i18n::ScriptType::COMPLEX == nScript && pBreakIt->GetScriptTypeDetector().is() ) + if( i18n::ScriptType::COMPLEX == nScript ) { - const short nScriptType = pBreakIt->GetScriptTypeDetector()->getCTLScriptType( rTxt, nSearchStt ); + const short nScriptType = ScriptTypeDetector::getCTLScriptType( rTxt, nSearchStt ); xub_StrLen nNextCTLScriptStart = nSearchStt; short nCurrentScriptType = nScriptType; while( com::sun::star::i18n::CTLScriptType::CTL_UNKNOWN == nCurrentScriptType || nScriptType == nCurrentScriptType ) { - nNextCTLScriptStart = (xub_StrLen)pBreakIt->GetScriptTypeDetector()->endOfCTLScriptType( rTxt, nNextCTLScriptStart ); + nNextCTLScriptStart = (xub_StrLen)ScriptTypeDetector::endOfCTLScriptType( rTxt, nNextCTLScriptStart ); if( nNextCTLScriptStart < rTxt.Len() && nNextCTLScriptStart < nChg ) - nCurrentScriptType = pBreakIt->GetScriptTypeDetector()->getCTLScriptType( rTxt, nNextCTLScriptStart ); + nCurrentScriptType = ScriptTypeDetector::getCTLScriptType( rTxt, nNextCTLScriptStart ); else break; } |