Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include "themebuffer.hxx"
30 : :
31 : : #include "stylesbuffer.hxx"
32 : :
33 : : namespace oox {
34 : : namespace xls {
35 : :
36 : : // ============================================================================
37 : :
38 : : using ::oox::drawingml::ClrScheme;
39 : :
40 : : // ============================================================================
41 : :
42 : : namespace {
43 : :
44 : : /** Specifies default theme fonts for a specific locale. */
45 : : struct BuiltinThemeFont
46 : : {
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.
50 : : };
51 : :
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"
56 : :
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
85 : : };
86 : :
87 : : } // namespace
88 : :
89 : : // ----------------------------------------------------------------------------
90 : :
91 : 24 : ThemeBuffer::ThemeBuffer( const WorkbookHelper& rHelper ) :
92 : : WorkbookHelper( rHelper ),
93 [ + - ][ + - ]: 24 : mxDefFontModel( new FontModel )
94 : : {
95 [ + - - - ]: 24 : switch( getFilterType() )
[ + - ]
96 : : {
97 : : case FILTER_OOXML:
98 : : //! TODO: locale dependent font name
99 [ + - ]: 24 : mxDefFontModel->maName = CREATE_OUSTRING( "Cambria" );
100 : 24 : mxDefFontModel->mfHeight = 11.0;
101 : 24 : break;
102 : : case FILTER_BIFF:
103 : : //! TODO: BIFF dependent font name
104 [ # # ]: 0 : mxDefFontModel->maName = CREATE_OUSTRING( "Arial" );
105 : 0 : mxDefFontModel->mfHeight = 10.0;
106 : 0 : break;
107 : 0 : case FILTER_UNKNOWN: break;
108 : : }
109 : 24 : }
110 : :
111 [ + - ][ + - ]: 24 : ThemeBuffer::~ThemeBuffer()
112 : : {
113 [ - + ]: 48 : }
114 : :
115 : 12 : sal_Int32 ThemeBuffer::getColorByToken( sal_Int32 nToken ) const
116 : : {
117 : 12 : sal_Int32 nColor = 0;
118 [ + - ][ + - ]: 12 : return getClrScheme().getColor( nToken, nColor ) ? nColor : API_RGB_TRANSPARENT;
119 : : }
120 : :
121 : : // ============================================================================
122 : :
123 : : } // namespace xls
124 [ + - ][ + - ]: 24 : } // namespace oox
125 : :
126 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|