From 02b36fcfe3e31f30cb34a145be6609930c406687 Mon Sep 17 00:00:00 2001 From: Kurt Zenker Date: Wed, 2 Nov 2005 08:57:06 +0000 Subject: INTEGRATION: CWS sj29 (1.10.42); FILE MERGED 2005/10/25 17:48:14 sj 1.10.42.1: #i55538# now using the correct font by supporting the script type --- .../customshapes/EnhancedCustomShapeFontWork.cxx | 46 +++++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) (limited to 'svx/source/customshapes') diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index 97a941804f..c48307d444 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -4,9 +4,9 @@ * * $RCSfile: EnhancedCustomShapeFontWork.cxx,v $ * - * $Revision: 1.10 $ + * $Revision: 1.11 $ * - * last change: $Author: kz $ $Date: 2005-10-05 13:23:01 $ + * last change: $Author: kz $ $Date: 2005-11-02 09:57:06 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -118,9 +118,6 @@ #ifndef _COM_SUN_STAR_I18N_SCRIPTTYPE_HDL_ #include #endif -#ifndef _COM_SUN_STAR_I18N_XBREAKITERATOR_HPP_ -#include -#endif #ifndef _BGFX_POLYPOLYGON_B2DPOLYGONTOOLS_HXX #include #endif @@ -306,7 +303,27 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F if ( rText.getLength() ) { // generating vcl/font - SvxFontItem& rFontItem = (SvxFontItem&)pCustomShape->GetMergedItem( EE_CHAR_FONTINFO ); + USHORT nScriptType = i18n::ScriptType::LATIN; + Reference< i18n::XBreakIterator > xBI( EnhancedCustomShapeFontWork::GetBreakIterator() ); + if ( xBI.is() ) + { + nScriptType = xBI->getScriptType( rText, 0 ); + sal_uInt16 nChg = 0; + if( i18n::ScriptType::WEAK == nScriptType ) + { + nChg = (xub_StrLen)xBI->endOfScript( rText, nChg, nScriptType ); + if( nChg < rText.getLength() ) + nScriptType = xBI->getScriptType( rText, nChg ); + else + nScriptType = i18n::ScriptType::LATIN; + } + } + UINT16 nFntItm = EE_CHAR_FONTINFO; + if ( nScriptType == i18n::ScriptType::COMPLEX ) + nFntItm = EE_CHAR_FONTINFO_CTL; + else if ( nScriptType == i18n::ScriptType::ASIAN ) + nFntItm = EE_CHAR_FONTINFO_CJK; + SvxFontItem& rFontItem = (SvxFontItem&)pCustomShape->GetMergedItem( nFntItm ); Font aFont; aFont.SetHeight( rFWData.nSingleLineHeight ); aFont.SetAlign( ALIGN_TOP ); @@ -928,6 +945,23 @@ SdrObject* CreateSdrObjectFromParagraphOutlines( const FWData& rFWData, const Sd return pRet; } +::com::sun::star::uno::Reference < ::com::sun::star::i18n::XBreakIterator > EnhancedCustomShapeFontWork::mxBreakIterator = 0; + +Reference < i18n::XBreakIterator > EnhancedCustomShapeFontWork::GetBreakIterator() +{ + if ( !mxBreakIterator.is() ) + { + Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); + Reference < XInterface > xI = xMSF->createInstance( rtl::OUString::createFromAscii( "com.sun.star.i18n.BreakIterator" ) ); + if ( xI.is() ) + { + Any x = xI->queryInterface( ::getCppuType((const Reference< i18n::XBreakIterator >*)0) ); + x >>= mxBreakIterator; + } + } + return mxBreakIterator; +} + SdrObject* EnhancedCustomShapeFontWork::CreateFontWork( const SdrObject* pShape2d, const SdrObject* pCustomShape ) { SdrObject* pRet = NULL; -- cgit v1.2.3