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