1*ca5ec200SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*ca5ec200SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*ca5ec200SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*ca5ec200SAndrew Rist * distributed with this work for additional information 6*ca5ec200SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*ca5ec200SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*ca5ec200SAndrew Rist * "License"); you may not use this file except in compliance 9*ca5ec200SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*ca5ec200SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*ca5ec200SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*ca5ec200SAndrew Rist * software distributed under the License is distributed on an 15*ca5ec200SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*ca5ec200SAndrew Rist * KIND, either express or implied. See the License for the 17*ca5ec200SAndrew Rist * specific language governing permissions and limitations 18*ca5ec200SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*ca5ec200SAndrew Rist *************************************************************/ 21*ca5ec200SAndrew Rist 22*ca5ec200SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #include "oox/xls/themebuffer.hxx" 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "oox/xls/stylesbuffer.hxx" 27cdf0e10cSrcweir 28cdf0e10cSrcweir namespace oox { 29cdf0e10cSrcweir namespace xls { 30cdf0e10cSrcweir 31cdf0e10cSrcweir // ============================================================================ 32cdf0e10cSrcweir 33cdf0e10cSrcweir using ::oox::drawingml::ClrScheme; 34cdf0e10cSrcweir 35cdf0e10cSrcweir // ============================================================================ 36cdf0e10cSrcweir 37cdf0e10cSrcweir namespace { 38cdf0e10cSrcweir 39cdf0e10cSrcweir /** Specifies default theme fonts for a specific locale. */ 40cdf0e10cSrcweir struct BuiltinThemeFont 41cdf0e10cSrcweir { 42cdf0e10cSrcweir const sal_Char* mpcLocale; /// The locale for this font setting. 43cdf0e10cSrcweir const sal_Char* mpcHeadFont; /// Default heading font. 44cdf0e10cSrcweir const sal_Char* mpcBodyFont; /// Default body font. 45cdf0e10cSrcweir }; 46cdf0e10cSrcweir 47cdf0e10cSrcweir #define FONT_JA "\357\274\255\357\274\263 \357\274\260\343\202\264\343\202\267\343\203\203\343\202\257" 48cdf0e10cSrcweir #define FONT_KO "\353\247\221\354\235\200 \352\263\240\353\224\225" 49cdf0e10cSrcweir #define FONT_CS "\345\256\213\344\275\223" 50cdf0e10cSrcweir #define FONT_CT "\346\226\260\347\264\260\346\230\216\351\253\224" 51cdf0e10cSrcweir 52cdf0e10cSrcweir static const BuiltinThemeFont spBuiltinThemeFonts[] = 53cdf0e10cSrcweir { // locale headings font body font 54cdf0e10cSrcweir { "*", "Cambria", "Calibri" }, // Default 55cdf0e10cSrcweir { "ar", "Times New Roman", "Arial" }, // Arabic 56cdf0e10cSrcweir { "bn", "Vrinda", "Vrinda" }, // Bengali 57cdf0e10cSrcweir { "div", "MV Boli", "MV Boli" }, // Divehi 58cdf0e10cSrcweir { "fa", "Times New Roman", "Arial" }, // Farsi 59cdf0e10cSrcweir { "gu", "Shruti", "Shruti" }, // Gujarati 60cdf0e10cSrcweir { "he", "Times New Roman", "Arial" }, // Hebrew 61cdf0e10cSrcweir { "hi", "Mangal", "Mangal" }, // Hindi 62cdf0e10cSrcweir { "ja", FONT_JA, FONT_JA }, // Japanese 63cdf0e10cSrcweir { "kn", "Tunga", "Tunga" }, // Kannada 64cdf0e10cSrcweir { "ko", FONT_KO, FONT_KO }, // Korean 65cdf0e10cSrcweir { "kok", "Mangal", "Mangal" }, // Konkani 66cdf0e10cSrcweir { "ml", "Kartika", "Kartika" }, // Malayalam 67cdf0e10cSrcweir { "mr", "Mangal", "Mangal" }, // Marathi 68cdf0e10cSrcweir { "pa", "Raavi", "Raavi" }, // Punjabi 69cdf0e10cSrcweir { "sa", "Mangal", "Mangal" }, // Sanskrit 70cdf0e10cSrcweir { "syr", "Estrangelo Edessa", "Estrangelo Edessa" }, // Syriac 71cdf0e10cSrcweir { "ta", "Latha", "Latha" }, // Tamil 72cdf0e10cSrcweir { "te", "Gautami", "Gautami" }, // Telugu 73cdf0e10cSrcweir { "th", "Tahoma", "Tahoma" }, // Thai 74cdf0e10cSrcweir { "ur", "Times New Roman", "Arial" }, // Urdu 75cdf0e10cSrcweir { "vi", "Times New Roman", "Arial" }, // Vietnamese 76cdf0e10cSrcweir { "zh", FONT_CS, FONT_CS }, // Chinese, Simplified 77cdf0e10cSrcweir { "zh-HK", FONT_CT, FONT_CT }, // Chinese, Hong Kong 78cdf0e10cSrcweir { "zh-MO", FONT_CT, FONT_CT }, // Chinese, Macau 79cdf0e10cSrcweir { "zh-TW", FONT_CT, FONT_CT } // Chinese, Taiwan 80cdf0e10cSrcweir }; 81cdf0e10cSrcweir 82cdf0e10cSrcweir } // namespace 83cdf0e10cSrcweir 84cdf0e10cSrcweir // ---------------------------------------------------------------------------- 85cdf0e10cSrcweir 86cdf0e10cSrcweir ThemeBuffer::ThemeBuffer( const WorkbookHelper& rHelper ) : 87cdf0e10cSrcweir WorkbookHelper( rHelper ), 88cdf0e10cSrcweir mxDefFontModel( new FontModel ) 89cdf0e10cSrcweir { 90cdf0e10cSrcweir switch( getFilterType() ) 91cdf0e10cSrcweir { 92cdf0e10cSrcweir case FILTER_OOXML: 93cdf0e10cSrcweir //! TODO: locale dependent font name 94cdf0e10cSrcweir mxDefFontModel->maName = CREATE_OUSTRING( "Cambria" ); 95cdf0e10cSrcweir mxDefFontModel->mfHeight = 11.0; 96cdf0e10cSrcweir break; 97cdf0e10cSrcweir case FILTER_BIFF: 98cdf0e10cSrcweir //! TODO: BIFF dependent font name 99cdf0e10cSrcweir mxDefFontModel->maName = CREATE_OUSTRING( "Arial" ); 100cdf0e10cSrcweir mxDefFontModel->mfHeight = 10.0; 101cdf0e10cSrcweir break; 102cdf0e10cSrcweir case FILTER_UNKNOWN: break; 103cdf0e10cSrcweir } 104cdf0e10cSrcweir } 105cdf0e10cSrcweir 106cdf0e10cSrcweir ThemeBuffer::~ThemeBuffer() 107cdf0e10cSrcweir { 108cdf0e10cSrcweir } 109cdf0e10cSrcweir 110cdf0e10cSrcweir sal_Int32 ThemeBuffer::getColorByToken( sal_Int32 nToken ) const 111cdf0e10cSrcweir { 112cdf0e10cSrcweir sal_Int32 nColor = 0; 113cdf0e10cSrcweir return getClrScheme().getColor( nToken, nColor ) ? nColor : API_RGB_TRANSPARENT; 114cdf0e10cSrcweir } 115cdf0e10cSrcweir 116cdf0e10cSrcweir // ============================================================================ 117cdf0e10cSrcweir 118cdf0e10cSrcweir } // namespace xls 119cdf0e10cSrcweir } // namespace oox 120