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