diff options
author | Thomas Lange <tl@openoffice.org> | 2001-11-21 10:59:49 +0000 |
---|---|---|
committer | Thomas Lange <tl@openoffice.org> | 2001-11-21 10:59:49 +0000 |
commit | 9f435b88b67920896906bf70a98761a6dad39e87 (patch) | |
tree | 2e5f958212c5e222fa2ba65fa0d1ecfc31c91a4f /starmath/source | |
parent | ee352989fdbe1a543fcbd29c89338a1f5fa98ea6 (diff) |
#95038# set default font for CJK and CTL when creating the EditEngine
Diffstat (limited to 'starmath/source')
-rw-r--r-- | starmath/source/document.cxx | 73 | ||||
-rw-r--r-- | starmath/source/edit.cxx | 28 |
2 files changed, 78 insertions, 23 deletions
diff --git a/starmath/source/document.cxx b/starmath/source/document.cxx index e5fcf2d17ca3..5ed8e3db7375 100644 --- a/starmath/source/document.cxx +++ b/starmath/source/document.cxx @@ -2,9 +2,9 @@ * * $RCSfile: document.cxx,v $ * - * $Revision: 1.44 $ + * $Revision: 1.45 $ * - * last change: $Author: tl $ $Date: 2001-11-02 12:13:16 $ + * last change: $Author: tl $ $Date: 2001-11-21 11:59:48 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -70,6 +70,12 @@ #ifndef _SVSTOR_HXX //autogen #include <so3/svstor.hxx> #endif +#ifndef _SVTOOLS_LINGUPROPS_HXX_ +#include <svtools/linguprops.hxx> +#endif +#ifndef _SVTOOLS_LINGUCFG_HXX_ +#include <svtools/lingucfg.hxx> +#endif #ifndef _SFXSMPLHINT_HXX //autogen #include <svtools/smplhint.hxx> #endif @@ -168,10 +174,20 @@ #ifndef _SVX_FHGTITEM_HXX #include <svx/fhgtitem.hxx> #endif +#ifndef _UNO_LINGU_HXX +#include <svx/unolingu.hxx> +#endif #ifndef _SFXSLSTITM_HXX #include <svtools/slstitm.hxx> #endif +#ifndef _COM_SUN_STAR_UNO_ANY_H_ +#include <com/sun/star/uno/Any.h> +#endif +#ifndef _COM_SUN_STAR_LANG_LOCALE_HPP_ +#include <com/sun/star/lang/Locale.hpp> +#endif + #ifndef STARMATH_HRC #include <starmath.hrc> #endif @@ -215,9 +231,12 @@ using namespace ::com::sun::star; +using namespace ::com::sun::star::lang; using namespace ::com::sun::star::ucb; using namespace ::com::sun::star::uno; +#define A2OU(x) rtl::OUString::createFromAscii( x ) + #ifndef SO2_DECL_SVSTORAGESTREAM_DEFINED #define SO2_DECL_SVSTORAGESTREAM_DEFINED SO2_DECL_REF(SvStorageStream) @@ -393,15 +412,53 @@ EditEngine& SmDocShell::GetEditEngine() { if (!pEditEngine) { - pEditEngineItemPool = EditEngine::CreatePool(); + //! + //! see also SmEditWindow::DataChanged ! + //! - Font aFont( Application::GetSettings().GetStyleSettings().GetAppFont() ); + pEditEngineItemPool = EditEngine::CreatePool(); - pEditEngineItemPool->SetPoolDefaultItem( - SvxFontItem( aFont.GetFamily(), aFont.GetName(), - aFont.GetStyleName(), aFont.GetPitch(), aFont.GetCharSet(), - EE_CHAR_FONTINFO ) ); + // + // set fonts to be used + // + SvtLinguOptions aOpt; + SvtLinguConfig().GetOptions( aOpt ); + // + struct FontDta { + INT16 nFallbackLang; + INT16 nLang; + USHORT nFontType; + USHORT nFontInfoId; + } aTable[3] = + { + // info to get western font to be used + { LANGUAGE_ENGLISH_US, LANGUAGE_NONE, + DEFAULTFONT_SERIF, EE_CHAR_FONTINFO }, + // info to get CJK font to be used + { LANGUAGE_JAPANESE, LANGUAGE_NONE, + DEFAULTFONT_CJK_TEXT, EE_CHAR_FONTINFO_CJK }, + // info to get CTL font to be used + { LANGUAGE_ARABIC, LANGUAGE_NONE, + DEFAULTFONT_CTL_TEXT, EE_CHAR_FONTINFO_CTL } + }; + aTable[0].nLang = aOpt.nDefaultLanguage; + aTable[1].nLang = aOpt.nDefaultLanguage_CJK; + aTable[2].nLang = aOpt.nDefaultLanguage_CTL; + // + for (int i = 0; i < 3; ++i) + { + const FontDta &rFntDta = aTable[i]; + LanguageType nLang = (LANGUAGE_NONE == rFntDta.nLang) ? + rFntDta.nFallbackLang : rFntDta.nLang; + Font aFont = Application::GetDefaultDevice()->GetDefaultFont( + rFntDta.nFontType, nLang, DEFAULTFONT_FLAGS_ONLYONE ); + pEditEngineItemPool->SetPoolDefaultItem( + SvxFontItem( aFont.GetFamily(), aFont.GetName(), + aFont.GetStyleName(), aFont.GetPitch(), aFont.GetCharSet(), + rFntDta.nFontInfoId ) ); + } + // set font heights SvxFontHeightItem aFontHeigt( Application::GetDefaultDevice()->LogicToPixel( Size( 0, 10 ), MapMode( MAP_POINT ) ).Height(), 100, diff --git a/starmath/source/edit.cxx b/starmath/source/edit.cxx index 73d5e2fd46c8..aa1051f2f737 100644 --- a/starmath/source/edit.cxx +++ b/starmath/source/edit.cxx @@ -2,9 +2,9 @@ * * $RCSfile: edit.cxx,v $ * - * $Revision: 1.16 $ + * $Revision: 1.17 $ * - * last change: $Author: tl $ $Date: 2001-09-21 08:25:50 $ + * last change: $Author: tl $ $Date: 2001-11-21 11:59:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -229,21 +229,19 @@ void SmEditWindow::DataChanged( const DataChangedEvent& ) if (pEditEngine && pEditEngineItemPool) { - Font aFont = GetFont(); + //! + //! see also SmDocShell::GetEditEngine() ! + //! + pEditEngine->SetDefTab( USHORT( GetTextWidth( C2S("XXXX") ) ) ); - long nFntHeight = aFont.GetSize().Height(); - - pEditEngineItemPool->SetPoolDefaultItem( - SvxFontItem( aFont.GetFamily(), aFont.GetName(), - aFont.GetStyleName(), aFont.GetPitch(), aFont.GetCharSet(), - EE_CHAR_FONTINFO ) ); - pEditEngineItemPool->SetPoolDefaultItem( - SvxFontHeightItem( nFntHeight, 100, EE_CHAR_FONTHEIGHT ) ); - pEditEngineItemPool->SetPoolDefaultItem( - SvxFontHeightItem( nFntHeight, 100, EE_CHAR_FONTHEIGHT_CJK ) ); - pEditEngineItemPool->SetPoolDefaultItem( - SvxFontHeightItem( nFntHeight, 100, EE_CHAR_FONTHEIGHT_CTL ) ); + SvxFontHeightItem aItem( GetFont().GetSize().Height(), 100, + EE_CHAR_FONTHEIGHT ); + pEditEngineItemPool->SetPoolDefaultItem( aItem ); + aItem.SetWhich( EE_CHAR_FONTHEIGHT_CJK ); + pEditEngineItemPool->SetPoolDefaultItem( aItem ); + aItem.SetWhich( EE_CHAR_FONTHEIGHT_CTL ); + pEditEngineItemPool->SetPoolDefaultItem( aItem ); // forces new settings to be used pEditEngine->Clear(); //#77957 incorrect font size |