1*1d2dbeb0SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*1d2dbeb0SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*1d2dbeb0SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*1d2dbeb0SAndrew Rist * distributed with this work for additional information 6*1d2dbeb0SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*1d2dbeb0SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*1d2dbeb0SAndrew Rist * "License"); you may not use this file except in compliance 9*1d2dbeb0SAndrew Rist * with the License. You may obtain a copy of the License at 10*1d2dbeb0SAndrew Rist * 11*1d2dbeb0SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*1d2dbeb0SAndrew Rist * 13*1d2dbeb0SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*1d2dbeb0SAndrew Rist * software distributed under the License is distributed on an 15*1d2dbeb0SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*1d2dbeb0SAndrew Rist * KIND, either express or implied. See the License for the 17*1d2dbeb0SAndrew Rist * specific language governing permissions and limitations 18*1d2dbeb0SAndrew Rist * under the License. 19*1d2dbeb0SAndrew Rist * 20*1d2dbeb0SAndrew Rist *************************************************************/ 21*1d2dbeb0SAndrew Rist 22*1d2dbeb0SAndrew Rist 23cdf0e10cSrcweir #ifndef _FONTCFG_HXX 24cdf0e10cSrcweir #define _FONTCFG_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <unotools/configitem.hxx> 27cdf0e10cSrcweir #include <tools/string.hxx> 28cdf0e10cSrcweir #include <i18npool/lang.h> 29cdf0e10cSrcweir #include <tools/debug.hxx> 30cdf0e10cSrcweir #include "swdllapi.h" 31cdf0e10cSrcweir 32cdf0e10cSrcweir #define FONT_STANDARD 0 33cdf0e10cSrcweir #define FONT_OUTLINE 1 34cdf0e10cSrcweir #define FONT_LIST 2 35cdf0e10cSrcweir #define FONT_CAPTION 3 36cdf0e10cSrcweir #define FONT_INDEX 4 37cdf0e10cSrcweir #define FONT_STANDARD_CJK 5 38cdf0e10cSrcweir #define FONT_OUTLINE_CJK 6 39cdf0e10cSrcweir #define FONT_LIST_CJK 7 40cdf0e10cSrcweir #define FONT_CAPTION_CJK 8 41cdf0e10cSrcweir #define FONT_INDEX_CJK 9 42cdf0e10cSrcweir #define FONT_STANDARD_CTL 10 43cdf0e10cSrcweir #define FONT_OUTLINE_CTL 11 44cdf0e10cSrcweir #define FONT_LIST_CTL 12 45cdf0e10cSrcweir #define FONT_CAPTION_CTL 13 46cdf0e10cSrcweir #define FONT_INDEX_CTL 14 47cdf0e10cSrcweir #define DEF_FONT_COUNT 15 48cdf0e10cSrcweir 49cdf0e10cSrcweir #define FONT_PER_GROUP 5 50cdf0e10cSrcweir 51cdf0e10cSrcweir #define FONT_GROUP_DEFAULT 0 52cdf0e10cSrcweir #define FONT_GROUP_CJK 1 53cdf0e10cSrcweir #define FONT_GROUP_CTL 2 54cdf0e10cSrcweir 55cdf0e10cSrcweir //pt-size of fonts 56cdf0e10cSrcweir #define FONTSIZE_DEFAULT 240 57cdf0e10cSrcweir #define FONTSIZE_OUTLINE 280 58cdf0e10cSrcweir 59cdf0e10cSrcweir 60cdf0e10cSrcweir class SW_DLLPUBLIC SwStdFontConfig : public utl::ConfigItem 61cdf0e10cSrcweir { 62cdf0e10cSrcweir String sDefaultFonts[DEF_FONT_COUNT]; 63cdf0e10cSrcweir sal_Int32 nDefaultFontHeight[DEF_FONT_COUNT]; 64cdf0e10cSrcweir 65cdf0e10cSrcweir SW_DLLPRIVATE com::sun::star::uno::Sequence<rtl::OUString> GetPropertyNames(); 66cdf0e10cSrcweir ChangeString(sal_uInt16 nFontType,const String & rSet)67cdf0e10cSrcweir void ChangeString(sal_uInt16 nFontType, const String& rSet) 68cdf0e10cSrcweir { 69cdf0e10cSrcweir if(sDefaultFonts[nFontType] != rSet) 70cdf0e10cSrcweir { 71cdf0e10cSrcweir SetModified(); 72cdf0e10cSrcweir sDefaultFonts[nFontType] = rSet; 73cdf0e10cSrcweir } 74cdf0e10cSrcweir } 75cdf0e10cSrcweir 76cdf0e10cSrcweir void ChangeInt( sal_uInt16 nFontType, sal_Int32 nHeight ); 77cdf0e10cSrcweir 78cdf0e10cSrcweir public: 79cdf0e10cSrcweir SwStdFontConfig(); 80cdf0e10cSrcweir ~SwStdFontConfig(); 81cdf0e10cSrcweir 82cdf0e10cSrcweir virtual void Commit(); 83cdf0e10cSrcweir virtual void Notify( const ::com::sun::star::uno::Sequence< rtl::OUString >& aPropertyNames ); 84cdf0e10cSrcweir GetFontStandard(sal_uInt8 nFontGroup) const85cdf0e10cSrcweir const String& GetFontStandard(sal_uInt8 nFontGroup) const {return sDefaultFonts[FONT_STANDARD + FONT_PER_GROUP * nFontGroup];} GetFontOutline(sal_uInt8 nFontGroup) const86cdf0e10cSrcweir const String& GetFontOutline(sal_uInt8 nFontGroup) const {return sDefaultFonts[FONT_OUTLINE + FONT_PER_GROUP * nFontGroup];} GetFontList(sal_uInt8 nFontGroup) const87cdf0e10cSrcweir const String& GetFontList (sal_uInt8 nFontGroup) const {return sDefaultFonts[FONT_LIST + FONT_PER_GROUP * nFontGroup];} GetFontCaption(sal_uInt8 nFontGroup) const88cdf0e10cSrcweir const String& GetFontCaption(sal_uInt8 nFontGroup) const {return sDefaultFonts[FONT_CAPTION + FONT_PER_GROUP * nFontGroup];} GetFontIndex(sal_uInt8 nFontGroup) const89cdf0e10cSrcweir const String& GetFontIndex (sal_uInt8 nFontGroup) const {return sDefaultFonts[FONT_INDEX + FONT_PER_GROUP * nFontGroup];} 90cdf0e10cSrcweir GetFontFor(sal_uInt16 nFontType) const91cdf0e10cSrcweir const String& GetFontFor(sal_uInt16 nFontType) const {return sDefaultFonts[nFontType];} 92cdf0e10cSrcweir sal_Bool IsFontDefault(sal_uInt16 nFontType) const; 93cdf0e10cSrcweir SetFontStandard(const String & rSet,sal_uInt8 nFontGroup)94cdf0e10cSrcweir void SetFontStandard(const String& rSet, sal_uInt8 nFontGroup) 95cdf0e10cSrcweir {ChangeString(FONT_STANDARD + FONT_PER_GROUP * nFontGroup, rSet);} 96cdf0e10cSrcweir SetFontOutline(const String & rSet,sal_uInt8 nFontGroup)97cdf0e10cSrcweir void SetFontOutline(const String& rSet, sal_uInt8 nFontGroup) 98cdf0e10cSrcweir { ChangeString(FONT_OUTLINE + FONT_PER_GROUP * nFontGroup, rSet);} SetFontList(const String & rSet,sal_uInt8 nFontGroup)99cdf0e10cSrcweir void SetFontList (const String& rSet, sal_uInt8 nFontGroup) 100cdf0e10cSrcweir { ChangeString(FONT_LIST + FONT_PER_GROUP * nFontGroup, rSet);} SetFontCaption(const String & rSet,sal_uInt8 nFontGroup)101cdf0e10cSrcweir void SetFontCaption(const String& rSet, sal_uInt8 nFontGroup) 102cdf0e10cSrcweir { ChangeString(FONT_CAPTION + FONT_PER_GROUP * nFontGroup, rSet);} SetFontIndex(const String & rSet,sal_uInt8 nFontGroup)103cdf0e10cSrcweir void SetFontIndex (const String& rSet, sal_uInt8 nFontGroup) 104cdf0e10cSrcweir { ChangeString(FONT_INDEX + FONT_PER_GROUP * nFontGroup, rSet);} 105cdf0e10cSrcweir SetFontHeight(sal_Int32 nHeight,sal_uInt8 nFont,sal_uInt8 nScriptType)106cdf0e10cSrcweir void SetFontHeight( sal_Int32 nHeight, sal_uInt8 nFont, sal_uInt8 nScriptType ) 107cdf0e10cSrcweir { ChangeInt(nFont + FONT_PER_GROUP * nScriptType, nHeight);} 108cdf0e10cSrcweir 109cdf0e10cSrcweir sal_Int32 GetFontHeight( sal_uInt8 nFont, sal_uInt8 nScriptType, LanguageType eLang ); 110cdf0e10cSrcweir 111cdf0e10cSrcweir static String GetDefaultFor(sal_uInt16 nFontType, LanguageType eLang); 112cdf0e10cSrcweir static sal_Int32 GetDefaultHeightFor(sal_uInt16 nFontType, LanguageType eLang); 113cdf0e10cSrcweir }; 114cdf0e10cSrcweir #endif 115cdf0e10cSrcweir 116cdf0e10cSrcweir 117