Update ooo320-m1
[ooovba.git] / oox / source / xls / themebuffer.cxx
blob07eac78dc7a4442336d9027e4a019eb0fe5eaf20
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: themebuffer.cxx,v $
10 * $Revision: 1.5.20.2 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #include "oox/xls/themebuffer.hxx"
32 #include "oox/xls/stylesbuffer.hxx"
33 #include "tokens.hxx"
35 using ::oox::drawingml::ClrScheme;
37 namespace oox {
38 namespace xls {
40 // ============================================================================
42 namespace {
44 /** Specifies default theme fonts for a specific locale. */
45 struct BuiltinThemeFont
47 const sal_Char* mpcLocale; /// The locale for this font setting.
48 const sal_Char* mpcHeadFont; /// Default heading font.
49 const sal_Char* mpcBodyFont; /// Default body font.
52 #define FONT_JA "\357\274\255\357\274\263 \357\274\260\343\202\264\343\202\267\343\203\203\343\202\257"
53 #define FONT_KO "\353\247\221\354\235\200 \352\263\240\353\224\225"
54 #define FONT_CS "\345\256\213\344\275\223"
55 #define FONT_CT "\346\226\260\347\264\260\346\230\216\351\253\224"
57 static const BuiltinThemeFont spBuiltinThemeFonts[] =
58 { // locale headings font body font
59 { "*", "Cambria", "Calibri" }, // Default
60 { "ar", "Times New Roman", "Arial" }, // Arabic
61 { "bn", "Vrinda", "Vrinda" }, // Bengali
62 { "div", "MV Boli", "MV Boli" }, // Divehi
63 { "fa", "Times New Roman", "Arial" }, // Farsi
64 { "gu", "Shruti", "Shruti" }, // Gujarati
65 { "he", "Times New Roman", "Arial" }, // Hebrew
66 { "hi", "Mangal", "Mangal" }, // Hindi
67 { "ja", FONT_JA, FONT_JA }, // Japanese
68 { "kn", "Tunga", "Tunga" }, // Kannada
69 { "ko", FONT_KO, FONT_KO }, // Korean
70 { "kok", "Mangal", "Mangal" }, // Konkani
71 { "ml", "Kartika", "Kartika" }, // Malayalam
72 { "mr", "Mangal", "Mangal" }, // Marathi
73 { "pa", "Raavi", "Raavi" }, // Punjabi
74 { "sa", "Mangal", "Mangal" }, // Sanskrit
75 { "syr", "Estrangelo Edessa", "Estrangelo Edessa" }, // Syriac
76 { "ta", "Latha", "Latha" }, // Tamil
77 { "te", "Gautami", "Gautami" }, // Telugu
78 { "th", "Tahoma", "Tahoma" }, // Thai
79 { "ur", "Times New Roman", "Arial" }, // Urdu
80 { "vi", "Times New Roman", "Arial" }, // Vietnamese
81 { "zh", FONT_CS, FONT_CS }, // Chinese, Simplified
82 { "zh-HK", FONT_CT, FONT_CT }, // Chinese, Hong Kong
83 { "zh-MO", FONT_CT, FONT_CT }, // Chinese, Macau
84 { "zh-TW", FONT_CT, FONT_CT } // Chinese, Taiwan
87 } // namespace
89 // ----------------------------------------------------------------------------
91 ThemeBuffer::ThemeBuffer( const WorkbookHelper& rHelper ) :
92 WorkbookHelper( rHelper ),
93 mxDefFontModel( new FontModel )
95 switch( getFilterType() )
97 case FILTER_OOX:
98 //! TODO: locale dependent font name
99 mxDefFontModel->maName = CREATE_OUSTRING( "Cambria" );
100 mxDefFontModel->mfHeight = 11.0;
101 break;
102 case FILTER_BIFF:
103 //! TODO: BIFF dependent font name
104 mxDefFontModel->maName = CREATE_OUSTRING( "Arial" );
105 mxDefFontModel->mfHeight = 10.0;
106 break;
107 case FILTER_UNKNOWN: break;
111 ThemeBuffer::~ThemeBuffer()
115 sal_Int32 ThemeBuffer::getColorByToken( sal_Int32 nToken ) const
117 sal_Int32 nColor = 0;
118 return getClrScheme().getColor( nToken, nColor ) ? nColor : API_RGB_TRANSPARENT;
121 // ============================================================================
123 } // namespace xls
124 } // namespace oox