Kaydet (Commit) 5b395625 authored tarafından Caolán McNamara's avatar Caolán McNamara

de-uno-ize ScriptTypeDetector

leave a UnoScriptTypeDetector implementation that points to the
trivial ScriptTypeDetector for external consumers, e.g. sdext
üst 14c4c26c
...@@ -79,7 +79,7 @@ $(eval $(call gb_Library_add_exception_objects,i18npool,\ ...@@ -79,7 +79,7 @@ $(eval $(call gb_Library_add_exception_objects,i18npool,\
i18npool/source/characterclassification/cclass_unicode \ i18npool/source/characterclassification/cclass_unicode \
i18npool/source/characterclassification/cclass_unicode_parser \ i18npool/source/characterclassification/cclass_unicode_parser \
i18npool/source/characterclassification/characterclassificationImpl \ i18npool/source/characterclassification/characterclassificationImpl \
i18npool/source/characterclassification/scripttypedetector \ i18npool/source/characterclassification/unoscripttypedetector \
i18npool/source/collator/chaptercollator \ i18npool/source/collator/chaptercollator \
i18npool/source/collator/collatorImpl \ i18npool/source/collator/collatorImpl \
i18npool/source/collator/collator_unicode \ i18npool/source/collator/collator_unicode \
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
* for a copy of the LGPLv3 License. * for a copy of the LGPLv3 License.
* *
************************************************************************/ ************************************************************************/
#ifndef _I18N_SCRIPTTYPEDETECTOR_HXX_ #ifndef _I18N_UNOSCRIPTTYPEDETECTOR_HXX_
#define _I18N_SCRIPTTYPEDETECTOR_HXX_ #define _I18N_UNOSCRIPTTYPEDETECTOR_HXX_
#include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XServiceInfo.hpp>
...@@ -34,18 +34,15 @@ ...@@ -34,18 +34,15 @@
#include <cppuhelper/implbase2.hxx> // helper for implementations #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::i18n::XScriptTypeDetector,
::com::sun::star::lang::XServiceInfo ::com::sun::star::lang::XServiceInfo
> >
{ {
public: public:
ScriptTypeDetector();
virtual ~ScriptTypeDetector();
// Methods // 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 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); virtual sal_Int32 SAL_CALL endOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 scriptDirection ) throw (::com::sun::star::uno::RuntimeException);
......
/* -*- 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: */
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
#define CCLASS_ALL #define CCLASS_ALL
#include <characterclassificationImpl.hxx> #include <characterclassificationImpl.hxx>
#include <scripttypedetector.hxx> #include <unoscripttypedetector.hxx>
#include <cclass_unicode.hxx> #include <cclass_unicode.hxx>
#define COLLATOR_ALL #define COLLATOR_ALL
...@@ -157,7 +157,7 @@ IMPL_CREATEINSTANCE( Collator_Unicode ) ...@@ -157,7 +157,7 @@ IMPL_CREATEINSTANCE( Collator_Unicode )
IMPL_CREATEINSTANCE_MSF( CharacterClassificationImpl ) IMPL_CREATEINSTANCE_MSF( CharacterClassificationImpl )
IMPL_CREATEINSTANCE_MSF( cclass_Unicode ) IMPL_CREATEINSTANCE_MSF( cclass_Unicode )
IMPL_CREATEINSTANCE_MSF( TransliterationImpl ) IMPL_CREATEINSTANCE_MSF( TransliterationImpl )
IMPL_CREATEINSTANCE( ScriptTypeDetector ) IMPL_CREATEINSTANCE( UnoScriptTypeDetector )
IMPL_CREATEINSTANCE_MSF( InputSequenceCheckerImpl ) IMPL_CREATEINSTANCE_MSF( InputSequenceCheckerImpl )
IMPL_CREATEINSTANCE( InputSequenceChecker_th ) IMPL_CREATEINSTANCE( InputSequenceChecker_th )
...@@ -388,7 +388,7 @@ static const struct InstancesArray { ...@@ -388,7 +388,7 @@ static const struct InstancesArray {
&Collator_Unicode_CreateInstance }, &Collator_Unicode_CreateInstance },
{ "com.sun.star.i18n.ScriptTypeDetector", { "com.sun.star.i18n.ScriptTypeDetector",
"com.sun.star.i18n.ScriptTypeDetector", "com.sun.star.i18n.ScriptTypeDetector",
&ScriptTypeDetector_CreateInstance }, &UnoScriptTypeDetector_CreateInstance },
{ "com.sun.star.i18n.CharacterClassification", { "com.sun.star.i18n.CharacterClassification",
"com.sun.star.i18n.CharacterClassification", "com.sun.star.i18n.CharacterClassification",
&CharacterClassificationImpl_CreateInstance }, &CharacterClassificationImpl_CreateInstance },
......
...@@ -48,6 +48,7 @@ $(eval $(call gb_Library_add_linked_libs,i18nutil,\ ...@@ -48,6 +48,7 @@ $(eval $(call gb_Library_add_linked_libs,i18nutil,\
$(eval $(call gb_Library_add_exception_objects,i18nutil,\ $(eval $(call gb_Library_add_exception_objects,i18nutil,\
i18nutil/source/utility/casefolding \ i18nutil/source/utility/casefolding \
i18nutil/source/utility/oneToOneMapping \ i18nutil/source/utility/oneToOneMapping \
i18nutil/source/utility/scripttypedetector \
i18nutil/source/utility/unicode \ i18nutil/source/utility/unicode \
i18nutil/source/utility/widthfolding \ i18nutil/source/utility/widthfolding \
)) ))
......
...@@ -30,6 +30,7 @@ $(eval $(call gb_Package_Package,i18nutil_inc,$(SRCDIR)/i18nutil/inc)) ...@@ -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/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/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/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/unicode.hxx,i18nutil/unicode.hxx))
$(eval $(call gb_Package_add_file,i18nutil_inc,inc/i18nutil/widthfolding.hxx,i18nutil/widthfolding.hxx)) $(eval $(call gb_Package_add_file,i18nutil_inc,inc/i18nutil/widthfolding.hxx,i18nutil/widthfolding.hxx))
......
/* -*- 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: */
...@@ -26,27 +26,14 @@ ...@@ -26,27 +26,14 @@
* *
************************************************************************/ ************************************************************************/
#include <com/sun/star/i18n/CTLScriptType.hpp> #include <com/sun/star/i18n/CTLScriptType.hpp>
#include <com/sun/star/i18n/ScriptDirection.hpp> #include <com/sun/star/i18n/ScriptDirection.hpp>
#include <com/sun/star/i18n/UnicodeScript.hpp> #include <com/sun/star/i18n/UnicodeScript.hpp>
#include <scripttypedetector.hxx> #include <i18nutil/scripttypedetector.hxx>
#include <i18nutil/unicode.hxx> #include <i18nutil/unicode.hxx>
// ----------------------------------------------------
// class ScriptTypeDetector
// ----------------------------------------------------;
using namespace com::sun::star::i18n; using namespace com::sun::star::i18n;
ScriptTypeDetector::ScriptTypeDetector()
{
}
ScriptTypeDetector::~ScriptTypeDetector()
{
}
static sal_Int16 scriptDirection[] = { static sal_Int16 scriptDirection[] = {
ScriptDirection::LEFT_TO_RIGHT, // DirectionProperty_LEFT_TO_RIGHT = 0, ScriptDirection::LEFT_TO_RIGHT, // DirectionProperty_LEFT_TO_RIGHT = 0,
ScriptDirection::RIGHT_TO_LEFT, // DirectionProperty_RIGHT_TO_LEFT = 1, ScriptDirection::RIGHT_TO_LEFT, // DirectionProperty_RIGHT_TO_LEFT = 1,
...@@ -69,16 +56,14 @@ static sal_Int16 scriptDirection[] = { ...@@ -69,16 +56,14 @@ static sal_Int16 scriptDirection[] = {
ScriptDirection::NEUTRAL, // DirectionProperty_BOUNDARY_NEUTRAL = 18, ScriptDirection::NEUTRAL, // DirectionProperty_BOUNDARY_NEUTRAL = 18,
}; };
sal_Int16 SAL_CALL sal_Int16 ScriptTypeDetector::getScriptDirection( const rtl::OUString& Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection )
ScriptTypeDetector::getScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 defaultScriptDirection ) throw (::com::sun::star::uno::RuntimeException)
{ {
sal_Int16 dir = scriptDirection[unicode::getUnicodeDirection(Text[nPos])]; sal_Int16 dir = scriptDirection[unicode::getUnicodeDirection(Text[nPos])];
return (dir == ScriptDirection::NEUTRAL) ? defaultScriptDirection : dir; 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. // return value '-1' means either the direction on nPos is not same as scriptDirection or nPos is out of range.
sal_Int32 SAL_CALL sal_Int32 ScriptTypeDetector::beginOfScriptDirection( const rtl::OUString& Text, sal_Int32 nPos, sal_Int16 direction )
ScriptTypeDetector::beginOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 direction ) throw (::com::sun::star::uno::RuntimeException)
{ {
sal_Int32 cPos = nPos; sal_Int32 cPos = nPos;
...@@ -91,8 +76,7 @@ ScriptTypeDetector::beginOfScriptDirection( const ::rtl::OUString& Text, sal_Int ...@@ -91,8 +76,7 @@ ScriptTypeDetector::beginOfScriptDirection( const ::rtl::OUString& Text, sal_Int
return cPos == nPos ? -1 : cPos + 1; return cPos == nPos ? -1 : cPos + 1;
} }
sal_Int32 SAL_CALL sal_Int32 ScriptTypeDetector::endOfScriptDirection( const rtl::OUString& Text, sal_Int32 nPos, sal_Int16 direction )
ScriptTypeDetector::endOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 nPos, sal_Int16 direction ) throw (::com::sun::star::uno::RuntimeException)
{ {
sal_Int32 cPos = nPos; sal_Int32 cPos = nPos;
sal_Int32 len = Text.getLength(); sal_Int32 len = Text.getLength();
...@@ -106,8 +90,7 @@ ScriptTypeDetector::endOfScriptDirection( const ::rtl::OUString& Text, sal_Int32 ...@@ -106,8 +90,7 @@ ScriptTypeDetector::endOfScriptDirection( const ::rtl::OUString& Text, sal_Int32
return cPos == nPos ? -1 : cPos; return cPos == nPos ? -1 : cPos;
} }
sal_Int16 SAL_CALL sal_Int16 ScriptTypeDetector::getCTLScriptType( const rtl::OUString& Text, sal_Int32 nPos )
ScriptTypeDetector::getCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException)
{ {
static ScriptTypeList typeList[] = { static ScriptTypeList typeList[] = {
{ UnicodeScript_kHebrew, UnicodeScript_kHebrew, CTLScriptType::CTL_HEBREW }, // 10 { UnicodeScript_kHebrew, UnicodeScript_kHebrew, CTLScriptType::CTL_HEBREW }, // 10
...@@ -121,8 +104,7 @@ ScriptTypeDetector::getCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPo ...@@ -121,8 +104,7 @@ ScriptTypeDetector::getCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPo
} }
// Begin of Script Type is inclusive. // Begin of Script Type is inclusive.
sal_Int32 SAL_CALL sal_Int32 ScriptTypeDetector::beginOfCTLScriptType( const rtl::OUString& Text, sal_Int32 nPos )
ScriptTypeDetector::beginOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException)
{ {
if (nPos < 0) if (nPos < 0)
return 0; return 0;
...@@ -139,8 +121,7 @@ ScriptTypeDetector::beginOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 ...@@ -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 // End of the Script Type is exclusive, the return value pointing to the begin of next script type
sal_Int32 SAL_CALL sal_Int32 ScriptTypeDetector::endOfCTLScriptType( const rtl::OUString& Text, sal_Int32 nPos )
ScriptTypeDetector::endOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 nPos ) throw (::com::sun::star::uno::RuntimeException)
{ {
if (nPos < 0) if (nPos < 0)
return 0; return 0;
...@@ -157,26 +138,4 @@ ScriptTypeDetector::endOfCTLScriptType( const ::rtl::OUString& Text, sal_Int32 n ...@@ -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: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -43,6 +43,7 @@ $(eval $(call gb_CppunitTest_add_linked_libs,sd_filters_test, \ ...@@ -43,6 +43,7 @@ $(eval $(call gb_CppunitTest_add_linked_libs,sd_filters_test, \
editeng \ editeng \
fileacc \ fileacc \
i18nisolang1 \ i18nisolang1 \
i18nutil \
msfilter \ msfilter \
oox \ oox \
sal \ sal \
......
...@@ -53,6 +53,7 @@ $(eval $(call gb_Library_add_linked_libs,sdfilt,\ ...@@ -53,6 +53,7 @@ $(eval $(call gb_Library_add_linked_libs,sdfilt,\
cppuhelper \ cppuhelper \
editeng \ editeng \
i18nisolang1 \ i18nisolang1 \
i18nutil \
msfilter \ msfilter \
oox \ oox \
sal \ sal \
......
...@@ -190,7 +190,7 @@ public : ...@@ -190,7 +190,7 @@ public :
~FontCollection(); ~FontCollection();
short GetScriptDirection( const String& rText ) const; short GetScriptDirection( const rtl::OUString& rText ) const;
sal_uInt32 GetId( FontCollectionEntry& rFontDescriptor ); sal_uInt32 GetId( FontCollectionEntry& rFontDescriptor );
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include <com/sun/star/i18n/XBreakIterator.hpp> #include <com/sun/star/i18n/XBreakIterator.hpp>
#include <com/sun/star/i18n/ScriptDirection.hpp> #include <com/sun/star/i18n/ScriptDirection.hpp>
#include <com/sun/star/i18n/ScriptType.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/FontRelief.hpp>
#include <com/sun/star/text/XTextField.hpp> #include <com/sun/star/text/XTextField.hpp>
#include <com/sun/star/text/XTextRange.hpp> #include <com/sun/star/text/XTextRange.hpp>
...@@ -46,19 +45,19 @@ ...@@ -46,19 +45,19 @@
#include <com/sun/star/style/ParagraphAdjust.hpp> #include <com/sun/star/style/ParagraphAdjust.hpp>
#include <com/sun/star/style/TabStop.hpp> #include <com/sun/star/style/TabStop.hpp>
#include <svl/languageoptions.hxx> #include <comphelper/processfactory.hxx>
#include <sfx2/app.hxx>
#include <editeng/svxenum.hxx> #include <editeng/svxenum.hxx>
#include <editeng/frmdir.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 <unotools/fontcvt.hxx>
#include <vcl/metric.hxx> #include <vcl/metric.hxx>
#include <vcl/outdev.hxx> #include <vcl/outdev.hxx>
#include <vcl/virdev.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::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, PortionObj::PortionObj( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & rXPropSet,
FontCollection& rFontCollection ) : FontCollection& rFontCollection ) :
...@@ -1339,7 +1338,6 @@ FontCollection::~FontCollection() ...@@ -1339,7 +1338,6 @@ FontCollection::~FontCollection()
{ {
delete pVDev; delete pVDev;
xPPTBreakIter = NULL; xPPTBreakIter = NULL;
xScriptTypeDetector = NULL;
} }
FontCollection::FontCollection() : FontCollection::FontCollection() :
...@@ -1352,21 +1350,11 @@ FontCollection::FontCollection() : ...@@ -1352,21 +1350,11 @@ FontCollection::FontCollection() :
if ( xInterface.is() ) if ( xInterface.is() )
xPPTBreakIter = com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > xPPTBreakIter = com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator >
( xInterface, com::sun::star::uno::UNO_QUERY ); ( 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; short nRet = ScriptTypeDetector::getScriptDirection( rString, 0, 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 );
}
return nRet; return nRet;
} }
......
...@@ -49,8 +49,6 @@ class SW_DLLPUBLIC SwBreakIt ...@@ -49,8 +49,6 @@ class SW_DLLPUBLIC SwBreakIt
{ {
com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMSF; com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > m_xMSF;
mutable com::sun::star::uno::Reference< com::sun::star::i18n::XBreakIterator > xBreak; 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::lang::Locale * m_pLocale;
com::sun::star::i18n::ForbiddenCharacters * m_pForbidden; com::sun::star::i18n::ForbiddenCharacters * m_pForbidden;
...@@ -89,12 +87,6 @@ public: ...@@ -89,12 +87,6 @@ public:
return xBreak; 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 ) const com::sun::star::lang::Locale& GetLocale( const LanguageType aLang )
{ {
if( !m_pLocale || aLast != aLang ) if( !m_pLocale || aLast != aLang )
......
...@@ -74,16 +74,13 @@ SwBreakIt::~SwBreakIt() ...@@ -74,16 +74,13 @@ SwBreakIt::~SwBreakIt()
delete m_pLocale; delete m_pLocale;
delete m_pForbidden; delete m_pForbidden;
} }
void SwBreakIt::createBreakIterator() const void SwBreakIt::createBreakIterator() const
{ {
if ( m_xMSF.is() && !xBreak.is() ) if ( m_xMSF.is() && !xBreak.is() )
xBreak.set(m_xMSF->createInstance(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator"))),uno::UNO_QUERY); 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 ) void SwBreakIt::_GetLocale( const LanguageType aLang )
{ {
aLast = aLang; aLast = aLang;
......
...@@ -64,7 +64,8 @@ using namespace ::com::sun::star; ...@@ -64,7 +64,8 @@ using namespace ::com::sun::star;
using namespace i18n::ScriptType; using namespace i18n::ScriptType;
#include <unicode/ubidi.h> #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 IS_JOINING_GROUP(c, g) ( u_getIntPropertyValue( (c), UCHAR_JOINING_GROUP ) == U_JG_##g )
#define isAinChar(c) IS_JOINING_GROUP((c), AIN) #define isAinChar(c) IS_JOINING_GROUP((c), AIN)
...@@ -904,16 +905,16 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL ) ...@@ -904,16 +905,16 @@ void SwScriptInfo::InitScriptInfo( const SwTxtNode& rNode, sal_Bool bRTL )
// #i28203# // #i28203#
// for 'complex' portions, we make sure that a portion does not contain more // for 'complex' portions, we make sure that a portion does not contain more
// than one script: // 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; xub_StrLen nNextCTLScriptStart = nSearchStt;
short nCurrentScriptType = nScriptType; short nCurrentScriptType = nScriptType;
while( com::sun::star::i18n::CTLScriptType::CTL_UNKNOWN == nCurrentScriptType || nScriptType == nCurrentScriptType ) 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 ) if( nNextCTLScriptStart < rTxt.Len() && nNextCTLScriptStart < nChg )
nCurrentScriptType = pBreakIt->GetScriptTypeDetector()->getCTLScriptType( rTxt, nNextCTLScriptStart ); nCurrentScriptType = ScriptTypeDetector::getCTLScriptType( rTxt, nNextCTLScriptStart );
else else
break; break;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment