fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / filter / excel / xlstyle.cxx
blob3a65bf6d2db35247bce84c69603c9bf6715d69bb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "xlstyle.hxx"
21 #include <com/sun/star/awt/FontFamily.hpp>
22 #include <com/sun/star/awt/FontSlant.hpp>
23 #include <com/sun/star/awt/FontUnderline.hpp>
24 #include <com/sun/star/i18n/ScriptType.hpp>
25 #include <vcl/svapp.hxx>
26 #include <vcl/settings.hxx>
27 #include <vcl/font.hxx>
28 #include <sal/macros.h>
29 #include <rtl/tencinfo.h>
30 #include <svtools/colorcfg.hxx>
31 #include <toolkit/helper/vclunohelper.hxx>
32 #include <editeng/svxfont.hxx>
33 #include "global.hxx"
34 #include "xlroot.hxx"
35 // Color data =================================================================
37 /** Standard EGA colors, bright. */
38 #define EXC_PALETTE_EGA_COLORS_LIGHT \
39 0x000000, 0xFFFFFF, 0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0xFF00FF, 0x00FFFF
40 /** Standard EGA colors, dark. */
41 #define EXC_PALETTE_EGA_COLORS_DARK \
42 0x800000, 0x008000, 0x000080, 0x808000, 0x800080, 0x008080, 0xC0C0C0, 0x808080
44 /** Default color table for BIFF2. */
45 static const ColorData spnDefColorTable2[] =
47 /* 0 */ EXC_PALETTE_EGA_COLORS_LIGHT
50 /** Default color table for BIFF3/BIFF4. */
51 static const ColorData spnDefColorTable3[] =
53 /* 0 */ EXC_PALETTE_EGA_COLORS_LIGHT,
54 /* 8 */ EXC_PALETTE_EGA_COLORS_LIGHT,
55 /* 16 */ EXC_PALETTE_EGA_COLORS_DARK
58 /** Default color table for BIFF5/BIFF7. */
59 static const ColorData spnDefColorTable5[] =
61 /* 0 */ EXC_PALETTE_EGA_COLORS_LIGHT,
62 /* 8 */ EXC_PALETTE_EGA_COLORS_LIGHT,
63 /* 16 */ EXC_PALETTE_EGA_COLORS_DARK,
64 /* 24 */ 0x8080FF, 0x802060, 0xFFFFC0, 0xA0E0E0, 0x600080, 0xFF8080, 0x0080C0, 0xC0C0FF,
65 /* 32 */ 0x000080, 0xFF00FF, 0xFFFF00, 0x00FFFF, 0x800080, 0x800000, 0x008080, 0x0000FF,
66 /* 40 */ 0x00CFFF, 0x69FFFF, 0xE0FFE0, 0xFFFF80, 0xA6CAF0, 0xDD9CB3, 0xB38FEE, 0xE3E3E3,
67 /* 48 */ 0x2A6FF9, 0x3FB8CD, 0x488436, 0x958C41, 0x8E5E42, 0xA0627A, 0x624FAC, 0x969696,
68 /* 56 */ 0x1D2FBE, 0x286676, 0x004500, 0x453E01, 0x6A2813, 0x85396A, 0x4A3285, 0x424242
71 /** Default color table for BIFF8. */
72 static const ColorData spnDefColorTable8[] =
74 /* 0 */ EXC_PALETTE_EGA_COLORS_LIGHT,
75 /* 8 */ EXC_PALETTE_EGA_COLORS_LIGHT,
76 /* 16 */ EXC_PALETTE_EGA_COLORS_DARK,
77 /* 24 */ 0x9999FF, 0x993366, 0xFFFFCC, 0xCCFFFF, 0x660066, 0xFF8080, 0x0066CC, 0xCCCCFF,
78 /* 32 */ 0x000080, 0xFF00FF, 0xFFFF00, 0x00FFFF, 0x800080, 0x800000, 0x008080, 0x0000FF,
79 /* 40 */ 0x00CCFF, 0xCCFFFF, 0xCCFFCC, 0xFFFF99, 0x99CCFF, 0xFF99CC, 0xCC99FF, 0xFFCC99,
80 /* 48 */ 0x3366FF, 0x33CCCC, 0x99CC00, 0xFFCC00, 0xFF9900, 0xFF6600, 0x666699, 0x969696,
81 /* 56 */ 0x003366, 0x339966, 0x003300, 0x333300, 0x993300, 0x993366, 0x333399, 0x333333
84 #undef EXC_PALETTE_EGA_COLORS_LIGHT
85 #undef EXC_PALETTE_EGA_COLORS_DARK
87 XclDefaultPalette::XclDefaultPalette( const XclRoot& rRoot ) :
88 mpnColorTable( 0 ),
89 mnTableSize( 0 )
91 const StyleSettings& rSett = Application::GetSettings().GetStyleSettings();
92 mnWindowText = rSett.GetWindowTextColor().GetColor();
93 mnWindowBack = rSett.GetWindowColor().GetColor();
94 mnFaceColor = rSett.GetFaceColor().GetColor();
95 // Don't use the system HelpBack and HelpText colours as it causes problems
96 // with modern gnome. This is because mnNoteText and mnNoteBack are used
97 // when colour indices ( instead of real colours ) are specified.
98 // Note: That this it is not an unusual scenario that we get the Note
99 // background specified as a real colour and the text specified as a
100 // colour index. That means the text colour would be picked from
101 // the system where the note background would be picked from a real colour.
102 // Previously the note text colour was picked from the system tooltip
103 // text colour, on modern gnome(e.g. 3) that tends to be 'white' with the
104 // default theme.
105 // Using the Libreoffice defaults ( instead of system specific colours
106 // ) lessens the chance of the one colour being an unsuitable combination
107 // because by default the note text is black and the note background is
108 // a light yellow colour ( very similar to Excel's normal defaults )
109 mnNoteText = svtools::ColorConfig::GetDefaultColor( svtools::FONTCOLOR ).GetColor();
110 mnNoteBack = svtools::ColorConfig::GetDefaultColor( svtools::CALCNOTESBACKGROUND ).GetColor();
112 // default colors
113 switch( rRoot.GetBiff() )
115 case EXC_BIFF2:
116 mpnColorTable = spnDefColorTable2;
117 mnTableSize = SAL_N_ELEMENTS( spnDefColorTable2 );
118 break;
119 case EXC_BIFF3:
120 case EXC_BIFF4:
121 mpnColorTable = spnDefColorTable3;
122 mnTableSize = SAL_N_ELEMENTS( spnDefColorTable3 );
123 break;
124 case EXC_BIFF5:
125 mpnColorTable = spnDefColorTable5;
126 mnTableSize = SAL_N_ELEMENTS( spnDefColorTable5 );
127 break;
128 case EXC_BIFF8:
129 mpnColorTable = spnDefColorTable8;
130 mnTableSize = SAL_N_ELEMENTS( spnDefColorTable8 );
131 break;
132 default:
133 DBG_ERROR_BIFF();
137 ColorData XclDefaultPalette::GetDefColorData( sal_uInt16 nXclIndex ) const
139 ColorData nColor;
140 if( nXclIndex < mnTableSize )
141 nColor = mpnColorTable[ nXclIndex ];
142 else switch( nXclIndex )
144 case EXC_COLOR_WINDOWTEXT3:
145 case EXC_COLOR_WINDOWTEXT:
146 case EXC_COLOR_CHWINDOWTEXT: nColor = mnWindowText; break;
147 case EXC_COLOR_WINDOWBACK3:
148 case EXC_COLOR_WINDOWBACK:
149 case EXC_COLOR_CHWINDOWBACK: nColor = mnWindowBack; break;
150 case EXC_COLOR_BUTTONBACK: nColor = mnFaceColor; break;
151 case EXC_COLOR_CHBORDERAUTO: nColor = COL_BLACK; break; // TODO: really always black?
152 case EXC_COLOR_NOTEBACK: nColor = mnNoteBack; break;
153 case EXC_COLOR_NOTETEXT: nColor = mnNoteText; break;
154 case EXC_COLOR_FONTAUTO: nColor = COL_AUTO; break;
155 default:
156 OSL_TRACE( "XclDefaultPalette::GetDefColorData - unknown default color index: %d", nXclIndex );
157 nColor = COL_AUTO;
159 return nColor;
162 // Font Data ==================================================================
164 namespace Awt = ::com::sun::star::awt;
165 namespace AwtFontFamily = Awt::FontFamily;
166 namespace AwtFontUnderline = Awt::FontUnderline;
167 namespace AwtFontStrikeout = Awt::FontStrikeout;
169 XclFontData::XclFontData()
171 Clear();
174 XclFontData::XclFontData( const vcl::Font& rFont )
176 Clear();
177 FillFromVclFont( rFont );
180 XclFontData::XclFontData( const SvxFont& rFont )
182 FillFromSvxFont( rFont );
185 void XclFontData::Clear()
187 maName.clear();
188 maStyle.clear();
189 maColor.SetColor( COL_AUTO );
190 mnHeight = 0;
191 mnWeight = EXC_FONTWGHT_DONTKNOW;
192 mnEscapem = EXC_FONTESC_NONE;
193 mnFamily = EXC_FONTFAM_SYSTEM;
194 mnCharSet = EXC_FONTCSET_ANSI_LATIN;
195 mnUnderline = EXC_FONTUNDERL_NONE;
196 mbItalic = mbStrikeout = mbOutline = mbShadow = false;
199 void XclFontData::FillFromVclFont( const vcl::Font& rFont )
201 maName = XclTools::GetXclFontName( rFont.GetName() ); // substitute with MS fonts
202 maStyle.clear();
203 maColor = rFont.GetColor();
204 SetScUnderline( rFont.GetUnderline() );
205 mnEscapem = EXC_FONTESC_NONE;
206 SetScHeight( rFont.GetSize().Height() );
207 SetScWeight( rFont.GetWeight() );
208 SetScFamily( rFont.GetFamily() );
209 SetFontEncoding( rFont.GetCharSet() );
210 SetScPosture( rFont.GetItalic() );
211 SetScStrikeout( rFont.GetStrikeout() );
212 mbOutline = rFont.IsOutline();
213 mbShadow = rFont.IsShadow();
216 void XclFontData::FillFromSvxFont( const SvxFont& rFont )
218 FillFromVclFont( rFont );
219 SetScEscapement( rFont.GetEscapement() );
222 // *** conversion of VCL/SVX constants *** ------------------------------------
224 FontFamily XclFontData::GetScFamily( rtl_TextEncoding eDefTextEnc ) const
226 FontFamily eScFamily;
227 // ! format differs from Windows documentation: family is in lower nibble, pitch unknown
228 switch( mnFamily & 0x0F )
230 case EXC_FONTFAM_ROMAN: eScFamily = FAMILY_ROMAN; break;
231 case EXC_FONTFAM_SWISS: eScFamily = FAMILY_SWISS; break;
232 case EXC_FONTFAM_MODERN: eScFamily = FAMILY_MODERN; break;
233 case EXC_FONTFAM_SCRIPT: eScFamily = FAMILY_SCRIPT; break;
234 case EXC_FONTFAM_DECORATIVE: eScFamily = FAMILY_DECORATIVE; break;
235 default:
236 eScFamily =
237 ((eDefTextEnc == RTL_TEXTENCODING_APPLE_ROMAN) &&
238 (maName.equalsIgnoreAsciiCase( "Geneva" ) || maName.equalsIgnoreAsciiCase( "Chicago" ))) ?
239 FAMILY_SWISS : FAMILY_DONTKNOW;
241 return eScFamily;
244 rtl_TextEncoding XclFontData::GetFontEncoding() const
246 // convert Windows character set to text encoding identifier
247 return rtl_getTextEncodingFromWindowsCharset( mnCharSet );
250 FontItalic XclFontData::GetScPosture() const
252 return mbItalic ? ITALIC_NORMAL : ITALIC_NONE;
255 FontWeight XclFontData::GetScWeight() const
257 FontWeight eScWeight;
259 if( !mnWeight ) eScWeight = WEIGHT_DONTKNOW;
260 else if( mnWeight < 150 ) eScWeight = WEIGHT_THIN;
261 else if( mnWeight < 250 ) eScWeight = WEIGHT_ULTRALIGHT;
262 else if( mnWeight < 325 ) eScWeight = WEIGHT_LIGHT;
263 else if( mnWeight < 375 ) eScWeight = WEIGHT_SEMILIGHT;
264 else if( mnWeight < 450 ) eScWeight = WEIGHT_NORMAL;
265 else if( mnWeight < 550 ) eScWeight = WEIGHT_MEDIUM;
266 else if( mnWeight < 650 ) eScWeight = WEIGHT_SEMIBOLD;
267 else if( mnWeight < 750 ) eScWeight = WEIGHT_BOLD;
268 else if( mnWeight < 850 ) eScWeight = WEIGHT_ULTRABOLD;
269 else eScWeight = WEIGHT_BLACK;
271 return eScWeight;
274 FontUnderline XclFontData::GetScUnderline() const
276 FontUnderline eScUnderl = UNDERLINE_NONE;
277 switch( mnUnderline )
279 case EXC_FONTUNDERL_SINGLE:
280 case EXC_FONTUNDERL_SINGLE_ACC: eScUnderl = UNDERLINE_SINGLE; break;
281 case EXC_FONTUNDERL_DOUBLE:
282 case EXC_FONTUNDERL_DOUBLE_ACC: eScUnderl = UNDERLINE_DOUBLE; break;
284 return eScUnderl;
287 SvxEscapement XclFontData::GetScEscapement() const
289 SvxEscapement eScEscapem = SVX_ESCAPEMENT_OFF;
290 switch( mnEscapem )
292 case EXC_FONTESC_SUPER: eScEscapem = SVX_ESCAPEMENT_SUPERSCRIPT; break;
293 case EXC_FONTESC_SUB: eScEscapem = SVX_ESCAPEMENT_SUBSCRIPT; break;
295 return eScEscapem;
298 FontStrikeout XclFontData::GetScStrikeout() const
300 return mbStrikeout ? STRIKEOUT_SINGLE : STRIKEOUT_NONE;
303 void XclFontData::SetScHeight( sal_Int32 nTwips )
305 mnHeight = static_cast< sal_uInt16 >( ::std::min( nTwips, static_cast<sal_Int32>(0x7FFFL) ) );
308 void XclFontData::SetScFamily( FontFamily eScFamily )
310 switch( eScFamily )
312 case FAMILY_DONTKNOW: mnFamily = EXC_FONTFAM_DONTKNOW; break;
313 case FAMILY_DECORATIVE: mnFamily = EXC_FONTFAM_DECORATIVE; break;
314 case FAMILY_MODERN: mnFamily = EXC_FONTFAM_MODERN; break;
315 case FAMILY_ROMAN: mnFamily = EXC_FONTFAM_ROMAN; break;
316 case FAMILY_SCRIPT: mnFamily = EXC_FONTFAM_SCRIPT; break;
317 case FAMILY_SWISS: mnFamily = EXC_FONTFAM_SWISS; break;
318 case FAMILY_SYSTEM: mnFamily = EXC_FONTFAM_SYSTEM; break;
319 default:
320 OSL_FAIL( "XclFontData::SetScFamily - unknown font family" );
321 mnFamily = EXC_FONTFAM_DONTKNOW;
325 void XclFontData::SetFontEncoding( rtl_TextEncoding eFontEnc )
327 // convert text encoding identifier to Windows character set
328 mnCharSet = rtl_getBestWindowsCharsetFromTextEncoding( eFontEnc );
331 void XclFontData::SetScPosture( FontItalic eScPosture )
333 mbItalic = (eScPosture == ITALIC_OBLIQUE) || (eScPosture == ITALIC_NORMAL);
336 void XclFontData::SetScWeight( FontWeight eScWeight )
338 switch( eScWeight )
340 case WEIGHT_DONTKNOW: mnWeight = EXC_FONTWGHT_DONTKNOW; break;
341 case WEIGHT_THIN: mnWeight = EXC_FONTWGHT_THIN; break;
342 case WEIGHT_ULTRALIGHT: mnWeight = EXC_FONTWGHT_ULTRALIGHT; break;
343 case WEIGHT_LIGHT: mnWeight = EXC_FONTWGHT_LIGHT; break;
344 case WEIGHT_SEMILIGHT: mnWeight = EXC_FONTWGHT_SEMILIGHT; break;
345 case WEIGHT_NORMAL: mnWeight = EXC_FONTWGHT_NORMAL; break;
346 case WEIGHT_MEDIUM: mnWeight = EXC_FONTWGHT_MEDIUM; break;
347 case WEIGHT_SEMIBOLD: mnWeight = EXC_FONTWGHT_SEMIBOLD; break;
348 case WEIGHT_BOLD: mnWeight = EXC_FONTWGHT_BOLD; break;
349 case WEIGHT_ULTRABOLD: mnWeight = EXC_FONTWGHT_ULTRABOLD; break;
350 case WEIGHT_BLACK: mnWeight = EXC_FONTWGHT_BLACK; break;
351 default: mnWeight = EXC_FONTWGHT_NORMAL;
355 void XclFontData::SetScUnderline( FontUnderline eScUnderl )
357 switch( eScUnderl )
359 case UNDERLINE_NONE:
360 case UNDERLINE_DONTKNOW: mnUnderline = EXC_FONTUNDERL_NONE; break;
361 case UNDERLINE_DOUBLE:
362 case UNDERLINE_DOUBLEWAVE: mnUnderline = EXC_FONTUNDERL_DOUBLE; break;
363 default: mnUnderline = EXC_FONTUNDERL_SINGLE;
367 void XclFontData::SetScEscapement( short nScEscapem )
369 if( nScEscapem > 0 )
370 mnEscapem = EXC_FONTESC_SUPER;
371 else if( nScEscapem < 0 )
372 mnEscapem = EXC_FONTESC_SUB;
373 else
374 mnEscapem = EXC_FONTESC_NONE;
377 void XclFontData::SetScStrikeout( FontStrikeout eScStrikeout )
379 mbStrikeout =
380 (eScStrikeout == STRIKEOUT_SINGLE) || (eScStrikeout == STRIKEOUT_DOUBLE) ||
381 (eScStrikeout == STRIKEOUT_BOLD) || (eScStrikeout == STRIKEOUT_SLASH) ||
382 (eScStrikeout == STRIKEOUT_X);
385 // *** conversion of API constants *** ----------------------------------------
387 float XclFontData::GetApiHeight() const
389 return static_cast< float >( mnHeight / TWIPS_PER_POINT );
392 sal_Int16 XclFontData::GetApiFamily() const
394 sal_Int16 nApiFamily = AwtFontFamily::DONTKNOW;
395 switch( mnFamily )
397 case FAMILY_DECORATIVE: nApiFamily = AwtFontFamily::DECORATIVE; break;
398 case FAMILY_MODERN: nApiFamily = AwtFontFamily::MODERN; break;
399 case FAMILY_ROMAN: nApiFamily = AwtFontFamily::ROMAN; break;
400 case FAMILY_SCRIPT: nApiFamily = AwtFontFamily::SCRIPT; break;
401 case FAMILY_SWISS: nApiFamily = AwtFontFamily::SWISS; break;
402 case FAMILY_SYSTEM: nApiFamily = AwtFontFamily::SYSTEM; break;
404 return nApiFamily;
407 sal_Int16 XclFontData::GetApiFontEncoding() const
409 // API constants are equal to rtl_TextEncoding constants
410 return static_cast< sal_Int16 >( GetFontEncoding() );
413 Awt::FontSlant XclFontData::GetApiPosture() const
415 return mbItalic ? Awt::FontSlant_ITALIC : Awt::FontSlant_NONE;
418 float XclFontData::GetApiWeight() const
420 return VCLUnoHelper::ConvertFontWeight( GetScWeight() );
423 sal_Int16 XclFontData::GetApiUnderline() const
425 sal_Int16 nApiUnderl = AwtFontUnderline::NONE;
426 switch( mnUnderline )
428 case EXC_FONTUNDERL_SINGLE:
429 case EXC_FONTUNDERL_SINGLE_ACC: nApiUnderl = AwtFontUnderline::SINGLE; break;
430 case EXC_FONTUNDERL_DOUBLE:
431 case EXC_FONTUNDERL_DOUBLE_ACC: nApiUnderl = AwtFontUnderline::DOUBLE; break;
433 return nApiUnderl;
436 sal_Int16 XclFontData::GetApiEscapement() const
438 sal_Int16 nApiEscapem = 0;
439 switch( mnEscapem )
441 case EXC_FONTESC_SUPER: nApiEscapem = 33; break;
442 case EXC_FONTESC_SUB: nApiEscapem = -33; break;
444 return nApiEscapem;
447 sal_Int16 XclFontData::GetApiStrikeout() const
449 return mbStrikeout ? AwtFontStrikeout::SINGLE : AwtFontStrikeout::NONE;
452 void XclFontData::SetApiHeight( float fPoint )
454 mnHeight = static_cast< sal_uInt16 >( ::std::min( fPoint * TWIPS_PER_POINT + 0.5, 32767.0 ) );
457 void XclFontData::SetApiFamily( sal_Int16 nApiFamily )
459 switch( nApiFamily )
461 case AwtFontFamily::DECORATIVE: mnFamily = FAMILY_DECORATIVE; break;
462 case AwtFontFamily::MODERN: mnFamily = FAMILY_MODERN; break;
463 case AwtFontFamily::ROMAN: mnFamily = FAMILY_ROMAN; break;
464 case AwtFontFamily::SCRIPT: mnFamily = FAMILY_SCRIPT; break;
465 case AwtFontFamily::SWISS: mnFamily = FAMILY_SWISS; break;
466 case AwtFontFamily::SYSTEM: mnFamily = FAMILY_SYSTEM; break;
467 default: mnFamily = FAMILY_DONTKNOW;
471 void XclFontData::SetApiPosture( Awt::FontSlant eApiPosture )
473 mbItalic =
474 (eApiPosture == Awt::FontSlant_OBLIQUE) ||
475 (eApiPosture == Awt::FontSlant_ITALIC) ||
476 (eApiPosture == Awt::FontSlant_REVERSE_OBLIQUE) ||
477 (eApiPosture == Awt::FontSlant_REVERSE_ITALIC);
480 void XclFontData::SetApiWeight( float fApiWeight )
482 SetScWeight( VCLUnoHelper::ConvertFontWeight( fApiWeight ) );
485 void XclFontData::SetApiUnderline( sal_Int16 nApiUnderl )
487 switch( nApiUnderl )
489 case AwtFontUnderline::NONE:
490 case AwtFontUnderline::DONTKNOW: mnUnderline = EXC_FONTUNDERL_NONE; break;
491 case AwtFontUnderline::DOUBLE:
492 case AwtFontUnderline::DOUBLEWAVE: mnUnderline = EXC_FONTUNDERL_DOUBLE; break;
493 default: mnUnderline = EXC_FONTUNDERL_SINGLE;
497 void XclFontData::SetApiEscapement( sal_Int16 nApiEscapem )
499 if( nApiEscapem > 0 )
500 mnEscapem = EXC_FONTESC_SUPER;
501 else if( nApiEscapem < 0 )
502 mnEscapem = EXC_FONTESC_SUB;
503 else
504 mnEscapem = EXC_FONTESC_NONE;
507 void XclFontData::SetApiStrikeout( sal_Int16 nApiStrikeout )
509 mbStrikeout =
510 (nApiStrikeout != AwtFontStrikeout::NONE) &&
511 (nApiStrikeout != AwtFontStrikeout::DONTKNOW);
514 bool operator==( const XclFontData& rLeft, const XclFontData& rRight )
516 return
517 (rLeft.mnHeight == rRight.mnHeight) &&
518 (rLeft.mnWeight == rRight.mnWeight) &&
519 (rLeft.mnUnderline == rRight.mnUnderline) &&
520 (rLeft.maColor == rRight.maColor) &&
521 (rLeft.mnEscapem == rRight.mnEscapem) &&
522 (rLeft.mnFamily == rRight.mnFamily) &&
523 (rLeft.mnCharSet == rRight.mnCharSet) &&
524 (rLeft.mbItalic == rRight.mbItalic) &&
525 (rLeft.mbStrikeout == rRight.mbStrikeout) &&
526 (rLeft.mbOutline == rRight.mbOutline) &&
527 (rLeft.mbShadow == rRight.mbShadow) &&
528 (rLeft.maName == rRight.maName);
531 namespace {
533 /** Property names for common font settings. */
534 const sal_Char *const sppcPropNamesChCommon[] =
536 "CharUnderline", "CharStrikeout", "CharColor", "CharContoured", "CharShadowed", 0
538 /** Property names for Western font settings. */
539 const sal_Char *const sppcPropNamesChWstrn[] =
541 "CharFontName", "CharHeight", "CharPosture", "CharWeight", 0
543 /** Property names for Asian font settings. */
544 const sal_Char *const sppcPropNamesChAsian[] =
546 "CharFontNameAsian", "CharHeightAsian", "CharPostureAsian", "CharWeightAsian", 0
548 /** Property names for Complex font settings. */
549 const sal_Char *const sppcPropNamesChCmplx[] =
551 "CharFontNameComplex", "CharHeightComplex", "CharPostureComplex", "CharWeightComplex", 0
553 /** Property names for escapement. */
554 const sal_Char *const sppcPropNamesChEscapement[] =
556 "CharEscapement", "CharEscapementHeight", 0
558 const sal_Int8 EXC_API_ESC_HEIGHT = 58; /// Default escapement font height.
560 /** Property names for Western font settings without font name. */
561 const sal_Char *const *const sppcPropNamesChWstrnNoName = sppcPropNamesChWstrn + 1;
562 /** Property names for Asian font settings without font name. */
563 const sal_Char *const *const sppcPropNamesChAsianNoName = sppcPropNamesChAsian + 1;
564 /** Property names for Complex font settings without font name. */
565 const sal_Char *const *const sppcPropNamesChCmplxNoName = sppcPropNamesChCmplx + 1;
567 /** Property names for font settings in form controls. */
568 const sal_Char *const sppcPropNamesControl[] =
570 "FontName", "FontFamily", "FontCharset", "FontHeight", "FontSlant",
571 "FontWeight", "FontUnderline", "FontStrikeout", "TextColor", 0
574 /** Inserts all passed API font settings into the font data object. */
575 void lclSetApiFontSettings( XclFontData& rFontData,
576 const OUString& rApiFontName, float fApiHeight, float fApiWeight,
577 Awt::FontSlant eApiPosture, sal_Int16 nApiUnderl, sal_Int16 nApiStrikeout )
579 rFontData.maName = XclTools::GetXclFontName( rApiFontName );
580 rFontData.SetApiHeight( fApiHeight );
581 rFontData.SetApiWeight( fApiWeight );
582 rFontData.SetApiPosture( eApiPosture );
583 rFontData.SetApiUnderline( nApiUnderl );
584 rFontData.SetApiStrikeout( nApiStrikeout );
587 /** Writes script dependent properties to a font property set helper. */
588 void lclWriteChartFont( ScfPropertySet& rPropSet,
589 ScfPropSetHelper& rHlpName, ScfPropSetHelper& rHlpNoName,
590 const XclFontData& rFontData, bool bHasFontName )
592 // select the font helper
593 ScfPropSetHelper& rPropSetHlp = bHasFontName ? rHlpName : rHlpNoName;
594 // initialize the font helper (must be called before writing any properties)
595 rPropSetHlp.InitializeWrite();
596 // write font name
597 if( bHasFontName )
598 rPropSetHlp << rFontData.maName;
599 // write remaining properties
600 rPropSetHlp << rFontData.GetApiHeight() << rFontData.GetApiPosture() << rFontData.GetApiWeight();
601 // write properties to property set
602 rPropSetHlp.WriteToPropertySet( rPropSet );
605 } // namespace
607 XclFontPropSetHelper::XclFontPropSetHelper() :
608 maHlpChCommon( sppcPropNamesChCommon ),
609 maHlpChWstrn( sppcPropNamesChWstrn ),
610 maHlpChAsian( sppcPropNamesChAsian ),
611 maHlpChCmplx( sppcPropNamesChCmplx ),
612 maHlpChWstrnNoName( sppcPropNamesChWstrnNoName ),
613 maHlpChAsianNoName( sppcPropNamesChAsianNoName ),
614 maHlpChCmplxNoName( sppcPropNamesChCmplxNoName ),
615 maHlpChEscapement( sppcPropNamesChEscapement ),
616 maHlpControl( sppcPropNamesControl )
620 void XclFontPropSetHelper::ReadFontProperties( XclFontData& rFontData,
621 const ScfPropertySet& rPropSet, XclFontPropSetType eType, sal_Int16 nScript )
623 switch( eType )
625 case EXC_FONTPROPSET_CHART:
627 OUString aApiFontName;
628 float fApiHeight, fApiWeight;
629 sal_Int16 nApiUnderl = 0, nApiStrikeout = 0;
630 Awt::FontSlant eApiPosture;
632 // read script type dependent properties
633 ScfPropSetHelper& rPropSetHlp = GetChartHelper( nScript );
634 rPropSetHlp.ReadFromPropertySet( rPropSet );
635 rPropSetHlp >> aApiFontName >> fApiHeight >> eApiPosture >> fApiWeight;
636 // read common properties
637 maHlpChCommon.ReadFromPropertySet( rPropSet );
638 maHlpChCommon >> nApiUnderl
639 >> nApiStrikeout
640 >> rFontData.maColor
641 >> rFontData.mbOutline
642 >> rFontData.mbShadow;
644 // convert API property values to Excel settings
645 lclSetApiFontSettings( rFontData, aApiFontName,
646 fApiHeight, fApiWeight, eApiPosture, nApiUnderl, nApiStrikeout );
648 // font escapement
649 sal_Int16 nApiEscapement = 0;
650 sal_Int8 nApiEscHeight = 0;
651 maHlpChEscapement.ReadFromPropertySet( rPropSet );
652 maHlpChEscapement.ReadFromPropertySet( rPropSet );
653 maHlpChEscapement.ReadFromPropertySet( rPropSet );
654 maHlpChEscapement >> nApiEscapement >> nApiEscHeight;
655 rFontData.SetApiEscapement( nApiEscapement );
657 break;
659 case EXC_FONTPROPSET_CONTROL:
661 OUString aApiFontName;
662 float fApiHeight, fApiWeight;
663 sal_Int16 nApiFamily, nApiCharSet, nApiPosture, nApiUnderl, nApiStrikeout;
665 // read font properties
666 maHlpControl.ReadFromPropertySet( rPropSet );
667 maHlpControl >> aApiFontName
668 >> nApiFamily
669 >> nApiCharSet
670 >> fApiHeight
671 >> nApiPosture
672 >> fApiWeight
673 >> nApiUnderl
674 >> nApiStrikeout
675 >> rFontData.maColor;
677 // convert API property values to Excel settings
678 Awt::FontSlant eApiPosture = static_cast< Awt::FontSlant >( nApiPosture );
679 lclSetApiFontSettings( rFontData, aApiFontName,
680 fApiHeight, fApiWeight, eApiPosture, nApiUnderl, nApiStrikeout );
681 rFontData.SetApiFamily( nApiFamily );
682 rFontData.SetFontEncoding( nApiCharSet );
684 break;
688 void XclFontPropSetHelper::WriteFontProperties(
689 ScfPropertySet& rPropSet, XclFontPropSetType eType,
690 const XclFontData& rFontData, bool bHasWstrn, bool bHasAsian, bool bHasCmplx,
691 const Color* pFontColor )
693 switch( eType )
695 case EXC_FONTPROPSET_CHART:
697 // write common properties
698 maHlpChCommon.InitializeWrite();
699 const Color& rColor = pFontColor ? *pFontColor : rFontData.maColor;
700 maHlpChCommon << rFontData.GetApiUnderline()
701 << rFontData.GetApiStrikeout()
702 << rColor
703 << rFontData.mbOutline
704 << rFontData.mbShadow;
705 maHlpChCommon.WriteToPropertySet( rPropSet );
707 // write script type dependent properties
708 lclWriteChartFont( rPropSet, maHlpChWstrn, maHlpChWstrnNoName, rFontData, bHasWstrn );
709 lclWriteChartFont( rPropSet, maHlpChAsian, maHlpChAsianNoName, rFontData, bHasAsian );
710 lclWriteChartFont( rPropSet, maHlpChCmplx, maHlpChCmplxNoName, rFontData, bHasCmplx );
712 // font escapement
713 if( rFontData.GetScEscapement() != SVX_ESCAPEMENT_OFF )
715 maHlpChEscapement.InitializeWrite();
716 maHlpChEscapement << rFontData.GetApiEscapement() << EXC_API_ESC_HEIGHT;
717 maHlpChEscapement.WriteToPropertySet( rPropSet );
720 break;
722 case EXC_FONTPROPSET_CONTROL:
724 maHlpControl.InitializeWrite();
725 maHlpControl << rFontData.maName
726 << rFontData.GetApiFamily()
727 << rFontData.GetApiFontEncoding()
728 << static_cast< sal_Int16 >( rFontData.GetApiHeight() + 0.5 )
729 << rFontData.GetApiPosture()
730 << rFontData.GetApiWeight()
731 << rFontData.GetApiUnderline()
732 << rFontData.GetApiStrikeout()
733 << rFontData.maColor;
734 maHlpControl.WriteToPropertySet( rPropSet );
736 break;
740 ScfPropSetHelper& XclFontPropSetHelper::GetChartHelper( sal_Int16 nScript )
742 namespace ApiScriptType = ::com::sun::star::i18n::ScriptType;
743 switch( nScript )
745 case ApiScriptType::LATIN: return maHlpChWstrn;
746 case ApiScriptType::ASIAN: return maHlpChAsian;
747 case ApiScriptType::COMPLEX: return maHlpChCmplx;
748 default: OSL_FAIL( "XclFontPropSetHelper::GetChartHelper - unknown script type" );
750 return maHlpChWstrn;
753 // Number formats =============================================================
755 namespace {
757 /** Special number format index describing a reused format. */
758 const NfIndexTableOffset PRV_NF_INDEX_REUSE = NF_INDEX_TABLE_ENTRIES;
760 /** German primary language not defined, LANGUAGE_GERMAN belongs to Germany. */
761 const LanguageType PRV_LANGUAGE_GERMAN_PRIM = LANGUAGE_GERMAN & LANGUAGE_MASK_PRIMARY;
762 /** French primary language not defined, LANGUAGE_FRENCH belongs to France. */
763 const LanguageType PRV_LANGUAGE_FRENCH_PRIM = LANGUAGE_FRENCH & LANGUAGE_MASK_PRIMARY;
764 /** Parent language identifier for Asian languages. */
765 const LanguageType PRV_LANGUAGE_ASIAN_PRIM = LANGUAGE_CHINESE & LANGUAGE_MASK_PRIMARY;
767 /** Stores the number format used in Calc for an Excel built-in number format. */
768 struct XclBuiltInFormat
770 sal_uInt16 mnXclNumFmt; /// Excel built-in index.
771 const sal_Char* mpFormat; /// Format string, may be 0 (meOffset used then).
772 NfIndexTableOffset meOffset; /// SvNumberFormatter format index, if mpFormat==0.
773 sal_uInt16 mnXclReuseFmt; /// Use this Excel format, if meOffset==PRV_NF_INDEX_REUSE.
776 /** Defines a literal Excel built-in number format. */
777 #define EXC_NUMFMT_STRING( nXclNumFmt, pcUtf8 ) \
778 { nXclNumFmt, pcUtf8, NF_NUMBER_STANDARD, 0 }
780 /** Defines an Excel built-in number format that maps to an own built-in format. */
781 #define EXC_NUMFMT_OFFSET( nXclNumFmt, eOffset ) \
782 { nXclNumFmt, 0, eOffset, 0 }
784 /** Defines an Excel built-in number format that is the same as the specified. */
785 #define EXC_NUMFMT_REUSE( nXclNumFmt, nXclReuse ) \
786 { nXclNumFmt, 0, PRV_NF_INDEX_REUSE, nXclReuse }
788 /** Terminates an Excel built-in number format table. */
789 #define EXC_NUMFMT_ENDTABLE() \
790 { EXC_FORMAT_NOTFOUND, 0, NF_NUMBER_STANDARD, 0 }
792 // Currency unit characters
793 #define UTF8_BAHT "\340\270\277"
794 #define UTF8_EURO "\342\202\254"
795 #define UTF8_POUND_UK "\302\243"
796 #define UTF8_SHEQEL "\342\202\252"
797 #define UTF8_WON "\357\277\246"
798 #define UTF8_YEN_CS "\357\277\245"
799 #define UTF8_YEN_JP "\302\245"
801 // Japanese/Chinese date/time characters
802 #define UTF8_CJ_YEAR "\345\271\264"
803 #define UTF8_CJ_MON "\346\234\210"
804 #define UTF8_CJ_DAY "\346\227\245"
805 #define UTF8_CJ_HOUR "\346\231\202"
806 #define UTF8_CJ_MIN "\345\210\206"
807 #define UTF8_CJ_SEC "\347\247\222"
809 // Chinese Simplified date/time characters
810 #define UTF8_CS_HOUR "\346\227\266"
812 // Korean date/time characters
813 #define UTF8_KO_YEAR "\353\205\204"
814 #define UTF8_KO_MON "\354\233\224"
815 #define UTF8_KO_DAY "\354\235\274"
816 #define UTF8_KO_HOUR "\354\213\234"
817 #define UTF8_KO_MIN "\353\266\204"
818 #define UTF8_KO_SEC "\354\264\210"
820 /** Default number format table. Last parent of all other tables, used for unknown languages. */
821 static const XclBuiltInFormat spBuiltInFormats_DONTKNOW[] =
823 EXC_NUMFMT_OFFSET( 0, NF_NUMBER_STANDARD ), // General
824 EXC_NUMFMT_OFFSET( 1, NF_NUMBER_INT ), // 0
825 EXC_NUMFMT_OFFSET( 2, NF_NUMBER_DEC2 ), // 0.00
826 EXC_NUMFMT_OFFSET( 3, NF_NUMBER_1000INT ), // #,##0
827 EXC_NUMFMT_OFFSET( 4, NF_NUMBER_1000DEC2 ), // #,##0.00
828 // 5...8 contained in file
829 EXC_NUMFMT_OFFSET( 9, NF_PERCENT_INT ), // 0%
830 EXC_NUMFMT_OFFSET( 10, NF_PERCENT_DEC2 ), // 0.00%
831 EXC_NUMFMT_OFFSET( 11, NF_SCIENTIFIC_000E00 ), // 0.00E+00
832 EXC_NUMFMT_OFFSET( 12, NF_FRACTION_1 ), // # ?/?
833 EXC_NUMFMT_OFFSET( 13, NF_FRACTION_2 ), // # ??/??
835 // 14...22 date and time formats
836 EXC_NUMFMT_OFFSET( 14, NF_DATE_SYS_DDMMYYYY ),
837 EXC_NUMFMT_OFFSET( 15, NF_DATE_SYS_DMMMYY ),
838 EXC_NUMFMT_OFFSET( 16, NF_DATE_SYS_DDMMM ),
839 EXC_NUMFMT_OFFSET( 17, NF_DATE_SYS_MMYY ),
840 EXC_NUMFMT_OFFSET( 18, NF_TIME_HHMMAMPM ),
841 EXC_NUMFMT_OFFSET( 19, NF_TIME_HHMMSSAMPM ),
842 EXC_NUMFMT_OFFSET( 20, NF_TIME_HHMM ),
843 EXC_NUMFMT_OFFSET( 21, NF_TIME_HHMMSS ),
844 EXC_NUMFMT_OFFSET( 22, NF_DATETIME_SYSTEM_SHORT_HHMM ),
846 // 23...36 international formats
847 EXC_NUMFMT_REUSE( 23, 0 ),
848 EXC_NUMFMT_REUSE( 24, 0 ),
849 EXC_NUMFMT_REUSE( 25, 0 ),
850 EXC_NUMFMT_REUSE( 26, 0 ),
851 EXC_NUMFMT_REUSE( 27, 14 ),
852 EXC_NUMFMT_REUSE( 28, 14 ),
853 EXC_NUMFMT_REUSE( 29, 14 ),
854 EXC_NUMFMT_REUSE( 30, 14 ),
855 EXC_NUMFMT_REUSE( 31, 14 ),
856 EXC_NUMFMT_REUSE( 32, 21 ),
857 EXC_NUMFMT_REUSE( 33, 21 ),
858 EXC_NUMFMT_REUSE( 34, 21 ),
859 EXC_NUMFMT_REUSE( 35, 21 ),
860 EXC_NUMFMT_REUSE( 36, 14 ),
862 // 37...44 accounting formats
863 // 41...44 contained in file
864 EXC_NUMFMT_STRING( 37, "#,##0;-#,##0" ),
865 EXC_NUMFMT_STRING( 38, "#,##0;[RED]-#,##0" ),
866 EXC_NUMFMT_STRING( 39, "#,##0.00;-#,##0.00" ),
867 EXC_NUMFMT_STRING( 40, "#,##0.00;[RED]-#,##0.00" ),
869 // 45...49 more special formats
870 EXC_NUMFMT_STRING( 45, "mm:ss" ),
871 EXC_NUMFMT_STRING( 46, "[h]:mm:ss" ),
872 EXC_NUMFMT_STRING( 47, "mm:ss.0" ),
873 EXC_NUMFMT_STRING( 48, "##0.0E+0" ),
874 EXC_NUMFMT_OFFSET( 49, NF_TEXT ),
876 // 50...81 international formats
877 EXC_NUMFMT_REUSE( 50, 14 ),
878 EXC_NUMFMT_REUSE( 51, 14 ),
879 EXC_NUMFMT_REUSE( 52, 14 ),
880 EXC_NUMFMT_REUSE( 53, 14 ),
881 EXC_NUMFMT_REUSE( 54, 14 ),
882 EXC_NUMFMT_REUSE( 55, 14 ),
883 EXC_NUMFMT_REUSE( 56, 14 ),
884 EXC_NUMFMT_REUSE( 57, 14 ),
885 EXC_NUMFMT_REUSE( 58, 14 ),
886 EXC_NUMFMT_REUSE( 59, 1 ),
887 EXC_NUMFMT_REUSE( 60, 2 ),
888 EXC_NUMFMT_REUSE( 61, 3 ),
889 EXC_NUMFMT_REUSE( 62, 4 ),
890 EXC_NUMFMT_REUSE( 67, 9 ),
891 EXC_NUMFMT_REUSE( 68, 10 ),
892 EXC_NUMFMT_REUSE( 69, 12 ),
893 EXC_NUMFMT_REUSE( 70, 13 ),
894 EXC_NUMFMT_REUSE( 71, 14 ),
895 EXC_NUMFMT_REUSE( 72, 14 ),
896 EXC_NUMFMT_REUSE( 73, 15 ),
897 EXC_NUMFMT_REUSE( 74, 16 ),
898 EXC_NUMFMT_REUSE( 75, 17 ),
899 EXC_NUMFMT_REUSE( 76, 20 ),
900 EXC_NUMFMT_REUSE( 77, 21 ),
901 EXC_NUMFMT_REUSE( 78, 22 ),
902 EXC_NUMFMT_REUSE( 79, 45 ),
903 EXC_NUMFMT_REUSE( 80, 46 ),
904 EXC_NUMFMT_REUSE( 81, 47 ),
906 // 82...163 not used, must not occur in a file (Excel may crash)
908 EXC_NUMFMT_ENDTABLE()
911 // ENGLISH --------------------------------------------------------------------
913 /** Base table for English locales. */
914 static const XclBuiltInFormat spBuiltInFormats_ENGLISH[] =
916 EXC_NUMFMT_STRING( 15, "DD-MMM-YY" ),
917 EXC_NUMFMT_STRING( 16, "DD-MMM" ),
918 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
919 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
920 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
921 EXC_NUMFMT_STRING( 22, "DD/MM/YYYY hh:mm" ),
922 EXC_NUMFMT_ENDTABLE()
925 static const XclBuiltInFormat spBuiltInFormats_ENGLISH_UK[] =
927 EXC_NUMFMT_STRING( 63, UTF8_POUND_UK "#,##0;-" UTF8_POUND_UK "#,##0" ),
928 EXC_NUMFMT_STRING( 64, UTF8_POUND_UK "#,##0;[RED]-" UTF8_POUND_UK "#,##0" ),
929 EXC_NUMFMT_STRING( 65, UTF8_POUND_UK "#,##0.00;-" UTF8_POUND_UK "#,##0.00" ),
930 EXC_NUMFMT_STRING( 66, UTF8_POUND_UK "#,##0.00;[RED]-" UTF8_POUND_UK "#,##0.00" ),
931 EXC_NUMFMT_ENDTABLE()
934 static const XclBuiltInFormat spBuiltInFormats_ENGLISH_EIRE[] =
936 EXC_NUMFMT_STRING( 63, UTF8_EURO "#,##0;-" UTF8_EURO "#,##0" ),
937 EXC_NUMFMT_STRING( 64, UTF8_EURO "#,##0;[RED]-" UTF8_EURO "#,##0" ),
938 EXC_NUMFMT_STRING( 65, UTF8_EURO "#,##0.00;-" UTF8_EURO "#,##0.00" ),
939 EXC_NUMFMT_STRING( 66, UTF8_EURO "#,##0.00;[RED]-" UTF8_EURO "#,##0.00" ),
940 EXC_NUMFMT_ENDTABLE()
943 static const XclBuiltInFormat spBuiltInFormats_ENGLISH_US[] =
945 EXC_NUMFMT_STRING( 14, "M/D/YYYY" ),
946 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
947 EXC_NUMFMT_STRING( 16, "D-MMM" ),
948 EXC_NUMFMT_STRING( 20, "h:mm" ),
949 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
950 EXC_NUMFMT_STRING( 22, "M/D/YYYY h:mm" ),
951 EXC_NUMFMT_STRING( 37, "#,##0_);(#,##0)" ),
952 EXC_NUMFMT_STRING( 38, "#,##0_);[RED](#,##0)" ),
953 EXC_NUMFMT_STRING( 39, "#,##0.00_);(#,##0.00)" ),
954 EXC_NUMFMT_STRING( 40, "#,##0.00_);[RED](#,##0.00)" ),
955 EXC_NUMFMT_STRING( 63, "$#,##0_);($#,##0)" ),
956 EXC_NUMFMT_STRING( 64, "$#,##0_);[RED]($#,##0)" ),
957 EXC_NUMFMT_STRING( 65, "$#,##0.00_);($#,##0.00)" ),
958 EXC_NUMFMT_STRING( 66, "$#,##0.00_);[RED]($#,##0.00)" ),
959 EXC_NUMFMT_ENDTABLE()
962 static const XclBuiltInFormat spBuiltInFormats_ENGLISH_CAN[] =
964 EXC_NUMFMT_STRING( 20, "h:mm" ),
965 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
966 EXC_NUMFMT_STRING( 22, "DD/MM/YYYY h:mm" ),
967 EXC_NUMFMT_STRING( 63, "$#,##0;-$#,##0" ),
968 EXC_NUMFMT_STRING( 64, "$#,##0;[RED]-$#,##0" ),
969 EXC_NUMFMT_STRING( 65, "$#,##0.00;-$#,##0.00" ),
970 EXC_NUMFMT_STRING( 66, "$#,##0.00;[RED]-$#,##0.00" ),
971 EXC_NUMFMT_ENDTABLE()
974 static const XclBuiltInFormat spBuiltInFormats_ENGLISH_AUS[] =
976 EXC_NUMFMT_STRING( 14, "D/MM/YYYY" ),
977 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
978 EXC_NUMFMT_STRING( 16, "D-MMM" ),
979 EXC_NUMFMT_STRING( 20, "h:mm" ),
980 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
981 EXC_NUMFMT_STRING( 22, "D/MM/YYYY h:mm" ),
982 EXC_NUMFMT_STRING( 63, "$#,##0;-$#,##0" ),
983 EXC_NUMFMT_STRING( 64, "$#,##0;[RED]-$#,##0" ),
984 EXC_NUMFMT_STRING( 65, "$#,##0.00;-$#,##0.00" ),
985 EXC_NUMFMT_STRING( 66, "$#,##0.00;[RED]-$#,##0.00" ),
986 EXC_NUMFMT_ENDTABLE()
989 static const XclBuiltInFormat spBuiltInFormats_ENGLISH_SAFRICA[] =
991 EXC_NUMFMT_STRING( 14, "YYYY/MM/DD" ),
992 EXC_NUMFMT_OFFSET( 18, NF_TIME_HHMMAMPM ),
993 EXC_NUMFMT_OFFSET( 19, NF_TIME_HHMMSSAMPM ),
994 EXC_NUMFMT_STRING( 22, "YYYY/MM/DD hh:mm" ),
995 EXC_NUMFMT_STRING( 63, "\\R #,##0;\\R -#,##0" ),
996 EXC_NUMFMT_STRING( 64, "\\R #,##0;[RED]\\R -#,##0" ),
997 EXC_NUMFMT_STRING( 65, "\\R #,##0.00;\\R -#,##0.00" ),
998 EXC_NUMFMT_STRING( 66, "\\R #,##0.00;[RED]\\R -#,##0.00" ),
999 EXC_NUMFMT_ENDTABLE()
1002 // FRENCH ---------------------------------------------------------------------
1004 /** Base table for French locales. */
1005 static const XclBuiltInFormat spBuiltInFormats_FRENCH[] =
1007 EXC_NUMFMT_STRING( 15, "DD-MMM-YY" ),
1008 EXC_NUMFMT_STRING( 16, "DD-MMM" ),
1009 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1010 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1011 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1012 EXC_NUMFMT_ENDTABLE()
1015 static const XclBuiltInFormat spBuiltInFormats_FRENCH_FRANCE[] =
1017 EXC_NUMFMT_STRING( 22, "DD/MM/YYYY hh:mm" ),
1018 EXC_NUMFMT_STRING( 37, "#,##0\\ _" UTF8_EURO ";-#,##0\\ _" UTF8_EURO ),
1019 EXC_NUMFMT_STRING( 38, "#,##0\\ _" UTF8_EURO ";[RED]-#,##0\\ _" UTF8_EURO ),
1020 EXC_NUMFMT_STRING( 39, "#,##0.00\\ _" UTF8_EURO ";-#,##0.00\\ _" UTF8_EURO ),
1021 EXC_NUMFMT_STRING( 40, "#,##0.00\\ _" UTF8_EURO ";[RED]-#,##0.00\\ _" UTF8_EURO ),
1022 EXC_NUMFMT_STRING( 63, "#,##0\\ " UTF8_EURO ";-#,##0\\ " UTF8_EURO ),
1023 EXC_NUMFMT_STRING( 64, "#,##0\\ " UTF8_EURO ";[RED]-#,##0\\ " UTF8_EURO ),
1024 EXC_NUMFMT_STRING( 65, "#,##0.00\\ " UTF8_EURO ";-#,##0.00\\ " UTF8_EURO ),
1025 EXC_NUMFMT_STRING( 66, "#,##0.00\\ " UTF8_EURO ";[RED]-#,##0.00\\ " UTF8_EURO ),
1026 EXC_NUMFMT_ENDTABLE()
1029 static const XclBuiltInFormat spBuiltInFormats_FRENCH_CANADIAN[] =
1031 EXC_NUMFMT_STRING( 22, "YYYY-MM-DD hh:mm" ),
1032 EXC_NUMFMT_STRING( 37, "#,##0\\ _$_-;#,##0\\ _$-" ),
1033 EXC_NUMFMT_STRING( 38, "#,##0\\ _$_-;[RED]#,##0\\ _$-" ),
1034 EXC_NUMFMT_STRING( 39, "#,##0.00\\ _$_-;#,##0.00\\ _$-" ),
1035 EXC_NUMFMT_STRING( 40, "#,##0.00\\ _$_-;[RED]#,##0.00\\ _$-" ),
1036 EXC_NUMFMT_STRING( 63, "#,##0\\ $_-;#,##0\\ $-" ),
1037 EXC_NUMFMT_STRING( 64, "#,##0\\ $_-;[RED]#,##0\\ $-" ),
1038 EXC_NUMFMT_STRING( 65, "#,##0.00\\ $_-;#,##0.00\\ $-" ),
1039 EXC_NUMFMT_STRING( 66, "#,##0.00\\ $_-;[RED]#,##0.00\\ $-" ),
1040 EXC_NUMFMT_ENDTABLE()
1043 static const XclBuiltInFormat spBuiltInFormats_FRENCH_SWISS[] =
1045 EXC_NUMFMT_STRING( 15, "DD.MMM.YY" ),
1046 EXC_NUMFMT_STRING( 16, "DD.MMM" ),
1047 EXC_NUMFMT_STRING( 17, "MMM.YY" ),
1048 EXC_NUMFMT_STRING( 22, "DD.MM.YYYY hh:mm" ),
1049 EXC_NUMFMT_STRING( 63, "\"SFr. \"#,##0;\"SFr. \"-#,##0" ),
1050 EXC_NUMFMT_STRING( 64, "\"SFr. \"#,##0;[RED]\"SFr. \"-#,##0" ),
1051 EXC_NUMFMT_STRING( 65, "\"SFr. \"#,##0.00;\"SFr. \"-#,##0.00" ),
1052 EXC_NUMFMT_STRING( 66, "\"SFr. \"#,##0.00;[RED]\"SFr. \"-#,##0.00" ),
1053 EXC_NUMFMT_ENDTABLE()
1056 static const XclBuiltInFormat spBuiltInFormats_FRENCH_BELGIAN[] =
1058 EXC_NUMFMT_STRING( 14, "D/MM/YYYY" ),
1059 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1060 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1061 EXC_NUMFMT_STRING( 20, "h:mm" ),
1062 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
1063 EXC_NUMFMT_STRING( 22, "D/MM/YYYY h:mm" ),
1064 EXC_NUMFMT_ENDTABLE()
1067 // GERMAN ---------------------------------------------------------------------
1069 /** Base table for German locales. */
1070 static const XclBuiltInFormat spBuiltInFormats_GERMAN[] =
1072 EXC_NUMFMT_STRING( 15, "DD. MMM YY" ),
1073 EXC_NUMFMT_STRING( 16, "DD. MMM" ),
1074 EXC_NUMFMT_STRING( 17, "MMM YY" ),
1075 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1076 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1077 EXC_NUMFMT_STRING( 22, "DD.MM.YYYY hh:mm" ),
1078 EXC_NUMFMT_ENDTABLE()
1081 static const XclBuiltInFormat spBuiltInFormats_GERMAN_GERMANY[] =
1083 EXC_NUMFMT_STRING( 37, "#,##0 _" UTF8_EURO ";-#,##0 _" UTF8_EURO ),
1084 EXC_NUMFMT_STRING( 38, "#,##0 _" UTF8_EURO ";[RED]-#,##0 _" UTF8_EURO ),
1085 EXC_NUMFMT_STRING( 39, "#,##0.00 _" UTF8_EURO ";-#,##0.00 _" UTF8_EURO ),
1086 EXC_NUMFMT_STRING( 40, "#,##0.00 _" UTF8_EURO ";[RED]-#,##0.00 _" UTF8_EURO ),
1087 EXC_NUMFMT_STRING( 63, "#,##0 " UTF8_EURO ";-#,##0 " UTF8_EURO ),
1088 EXC_NUMFMT_STRING( 64, "#,##0 " UTF8_EURO ";[RED]-#,##0 " UTF8_EURO ),
1089 EXC_NUMFMT_STRING( 65, "#,##0.00 " UTF8_EURO ";-#,##0.00 " UTF8_EURO ),
1090 EXC_NUMFMT_STRING( 66, "#,##0.00 " UTF8_EURO ";[RED]-#,##0.00 " UTF8_EURO ),
1091 EXC_NUMFMT_ENDTABLE()
1094 static const XclBuiltInFormat spBuiltInFormats_GERMAN_AUSTRIAN[] =
1096 EXC_NUMFMT_STRING( 15, "DD.MMM.YY" ),
1097 EXC_NUMFMT_STRING( 16, "DD.MMM" ),
1098 EXC_NUMFMT_STRING( 17, "MMM.YY" ),
1099 EXC_NUMFMT_STRING( 63, UTF8_EURO " #,##0;-" UTF8_EURO " #,##0" ),
1100 EXC_NUMFMT_STRING( 64, UTF8_EURO " #,##0;[RED]-" UTF8_EURO " #,##0" ),
1101 EXC_NUMFMT_STRING( 65, UTF8_EURO " #,##0.00;-" UTF8_EURO " #,##0.00" ),
1102 EXC_NUMFMT_STRING( 66, UTF8_EURO " #,##0.00;[RED]-" UTF8_EURO " #,##0.00" ),
1103 EXC_NUMFMT_ENDTABLE()
1106 static const XclBuiltInFormat spBuiltInFormats_GERMAN_SWISS[] =
1108 EXC_NUMFMT_STRING( 63, "\"SFr. \"#,##0;\"SFr. \"-#,##0" ),
1109 EXC_NUMFMT_STRING( 64, "\"SFr. \"#,##0;[RED]\"SFr. \"-#,##0" ),
1110 EXC_NUMFMT_STRING( 65, "\"SFr. \"#,##0.00;\"SFr. \"-#,##0.00" ),
1111 EXC_NUMFMT_STRING( 66, "\"SFr. \"#,##0.00;[RED]\"SFr. \"-#,##0.00" ),
1112 EXC_NUMFMT_ENDTABLE()
1115 static const XclBuiltInFormat spBuiltInFormats_GERMAN_LUXEMBOURG[] =
1117 EXC_NUMFMT_STRING( 15, "DD.MMM.YY" ),
1118 EXC_NUMFMT_STRING( 16, "DD.MMM" ),
1119 EXC_NUMFMT_STRING( 17, "MMM.YY" ),
1120 EXC_NUMFMT_STRING( 37, "#,##0 _" UTF8_EURO ";-#,##0 _" UTF8_EURO ),
1121 EXC_NUMFMT_STRING( 38, "#,##0 _" UTF8_EURO ";[RED]-#,##0 _" UTF8_EURO ),
1122 EXC_NUMFMT_STRING( 39, "#,##0.00 _" UTF8_EURO ";-#,##0.00 _" UTF8_EURO ),
1123 EXC_NUMFMT_STRING( 40, "#,##0.00 _" UTF8_EURO ";[RED]-#,##0.00 _" UTF8_EURO ),
1124 EXC_NUMFMT_STRING( 63, "#,##0 " UTF8_EURO ";-#,##0 " UTF8_EURO ),
1125 EXC_NUMFMT_STRING( 64, "#,##0 " UTF8_EURO ";[RED]-#,##0 " UTF8_EURO ),
1126 EXC_NUMFMT_STRING( 65, "#,##0.00 " UTF8_EURO ";-#,##0.00 " UTF8_EURO ),
1127 EXC_NUMFMT_STRING( 66, "#,##0.00 " UTF8_EURO ";[RED]-#,##0.00 " UTF8_EURO ),
1128 EXC_NUMFMT_ENDTABLE()
1131 static const XclBuiltInFormat spBuiltInFormats_GERMAN_LIECHTENSTEIN[] =
1133 EXC_NUMFMT_STRING( 63, "\"CHF \"#,##0;\"CHF \"-#,##0" ),
1134 EXC_NUMFMT_STRING( 64, "\"CHF \"#,##0;[RED]\"CHF \"-#,##0" ),
1135 EXC_NUMFMT_STRING( 65, "\"CHF \"#,##0.00;\"CHF \"-#,##0.00" ),
1136 EXC_NUMFMT_STRING( 66, "\"CHF \"#,##0.00;[RED]\"CHF \"-#,##0.00" ),
1137 EXC_NUMFMT_ENDTABLE()
1140 // ITALIAN --------------------------------------------------------------------
1142 static const XclBuiltInFormat spBuiltInFormats_ITALIAN_ITALY[] =
1144 EXC_NUMFMT_STRING( 15, "DD-MMM-YY" ),
1145 EXC_NUMFMT_STRING( 16, "DD-MMM" ),
1146 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1147 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1148 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1149 EXC_NUMFMT_STRING( 20, "h:mm" ),
1150 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
1151 EXC_NUMFMT_STRING( 22, "DD/MM/YYYY h:mm" ),
1152 EXC_NUMFMT_STRING( 63, UTF8_EURO " #,##0;-" UTF8_EURO " #,##0" ),
1153 EXC_NUMFMT_STRING( 64, UTF8_EURO " #,##0;[RED]-" UTF8_EURO " #,##0" ),
1154 EXC_NUMFMT_STRING( 65, UTF8_EURO " #,##0.00;-" UTF8_EURO " #,##0.00" ),
1155 EXC_NUMFMT_STRING( 66, UTF8_EURO " #,##0.00;[RED]-" UTF8_EURO " #,##0.00" ),
1156 EXC_NUMFMT_ENDTABLE()
1159 static const XclBuiltInFormat spBuiltInFormats_ITALIAN_SWISS[] =
1161 EXC_NUMFMT_STRING( 15, "DD.MMM.YY" ),
1162 EXC_NUMFMT_STRING( 16, "DD.MMM" ),
1163 EXC_NUMFMT_STRING( 17, "MMM.YY" ),
1164 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1165 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1166 EXC_NUMFMT_STRING( 22, "DD.MM.YYYY hh:mm" ),
1167 EXC_NUMFMT_STRING( 63, "\"SFr. \"#,##0;\"SFr. \"-#,##0" ),
1168 EXC_NUMFMT_STRING( 64, "\"SFr. \"#,##0;[RED]\"SFr. \"-#,##0" ),
1169 EXC_NUMFMT_STRING( 65, "\"SFr. \"#,##0.00;\"SFr. \"-#,##0.00" ),
1170 EXC_NUMFMT_STRING( 66, "\"SFr. \"#,##0.00;[RED]\"SFr. \"-#,##0.00" ),
1171 EXC_NUMFMT_ENDTABLE()
1174 // SWEDISH --------------------------------------------------------------------
1176 static const XclBuiltInFormat spBuiltInFormats_SWEDISH_SWEDEN[] =
1178 EXC_NUMFMT_STRING( 15, "DD-MMM-YY" ),
1179 EXC_NUMFMT_STRING( 16, "DD-MMM" ),
1180 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1181 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1182 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1183 EXC_NUMFMT_STRING( 22, "YYYY-MM-DD hh:mm" ),
1184 EXC_NUMFMT_STRING( 37, "#,##0 _k_r;-#,##0 _k_r" ),
1185 EXC_NUMFMT_STRING( 38, "#,##0 _k_r;[RED]-#,##0 _k_r" ),
1186 EXC_NUMFMT_STRING( 39, "#,##0.00 _k_r;-#,##0.00 _k_r" ),
1187 EXC_NUMFMT_STRING( 40, "#,##0.00 _k_r;[RED]-#,##0.00 _k_r" ),
1188 EXC_NUMFMT_STRING( 63, "#,##0 \"kr\";-#,##0 \"kr\"" ),
1189 EXC_NUMFMT_STRING( 64, "#,##0 \"kr\";[RED]-#,##0 \"kr\"" ),
1190 EXC_NUMFMT_STRING( 65, "#,##0.00 \"kr\";-#,##0.00 \"kr\"" ),
1191 EXC_NUMFMT_STRING( 66, "#,##0.00 \"kr\";[RED]-#,##0.00 \"kr\"" ),
1192 EXC_NUMFMT_ENDTABLE()
1195 static const XclBuiltInFormat spBuiltInFormats_SWEDISH_FINLAND[] =
1197 EXC_NUMFMT_STRING( 9, "0 %" ),
1198 EXC_NUMFMT_STRING( 10, "0.00 %" ),
1199 EXC_NUMFMT_STRING( 15, "DD.MMM.YY" ),
1200 EXC_NUMFMT_STRING( 16, "DD.MMM" ),
1201 EXC_NUMFMT_STRING( 17, "MMM.YY" ),
1202 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1203 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1204 EXC_NUMFMT_STRING( 22, "D.M.YYYY hh:mm" ),
1205 EXC_NUMFMT_STRING( 37, "#,##0 _" UTF8_EURO ";-#,##0 _" UTF8_EURO ),
1206 EXC_NUMFMT_STRING( 38, "#,##0 _" UTF8_EURO ";[RED]-#,##0 _" UTF8_EURO ),
1207 EXC_NUMFMT_STRING( 39, "#,##0.00 _" UTF8_EURO ";-#,##0.00 _" UTF8_EURO ),
1208 EXC_NUMFMT_STRING( 40, "#,##0.00 _" UTF8_EURO ";[RED]-#,##0.00 _" UTF8_EURO ),
1209 EXC_NUMFMT_STRING( 63, "#,##0 " UTF8_EURO ";-#,##0 " UTF8_EURO ),
1210 EXC_NUMFMT_STRING( 64, "#,##0 " UTF8_EURO ";[RED]-#,##0 " UTF8_EURO ),
1211 EXC_NUMFMT_STRING( 65, "#,##0.00 " UTF8_EURO ";-#,##0.00 " UTF8_EURO ),
1212 EXC_NUMFMT_STRING( 66, "#,##0.00 " UTF8_EURO ";[RED]-#,##0.00 " UTF8_EURO ),
1213 EXC_NUMFMT_ENDTABLE()
1216 // ASIAN ----------------------------------------------------------------------
1218 /** Base table for Asian locales. */
1219 static const XclBuiltInFormat spBuiltInFormats_ASIAN[] =
1221 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1222 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1223 EXC_NUMFMT_STRING( 20, "h:mm" ),
1224 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
1225 EXC_NUMFMT_STRING( 23, "$#,##0_);($#,##0)" ),
1226 EXC_NUMFMT_STRING( 24, "$#,##0_);[RED]($#,##0)" ),
1227 EXC_NUMFMT_STRING( 25, "$#,##0.00_);($#,##0.00)" ),
1228 EXC_NUMFMT_STRING( 26, "$#,##0.00_);[RED]($#,##0.00)" ),
1229 EXC_NUMFMT_REUSE( 29, 28 ),
1230 EXC_NUMFMT_REUSE( 36, 27 ),
1231 EXC_NUMFMT_REUSE( 50, 27 ),
1232 EXC_NUMFMT_REUSE( 51, 28 ),
1233 EXC_NUMFMT_REUSE( 52, 34 ),
1234 EXC_NUMFMT_REUSE( 53, 35 ),
1235 EXC_NUMFMT_REUSE( 54, 28 ),
1236 EXC_NUMFMT_REUSE( 55, 34 ),
1237 EXC_NUMFMT_REUSE( 56, 35 ),
1238 EXC_NUMFMT_REUSE( 57, 27 ),
1239 EXC_NUMFMT_REUSE( 58, 28 ),
1240 EXC_NUMFMT_ENDTABLE()
1243 static const XclBuiltInFormat spBuiltInFormats_JAPANESE[] =
1245 EXC_NUMFMT_STRING( 14, "YYYY/M/D" ),
1246 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1247 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1248 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1249 EXC_NUMFMT_STRING( 22, "YYYY/M/D h:mm" ),
1250 EXC_NUMFMT_STRING( 27, "[$-0411]GE.M.D" ),
1251 EXC_NUMFMT_STRING( 28, "[$-0411]GGGE" UTF8_CJ_YEAR "M" UTF8_CJ_MON "D" UTF8_CJ_DAY ),
1252 EXC_NUMFMT_STRING( 30, "[$-0411]M/D/YY" ),
1253 EXC_NUMFMT_STRING( 31, "[$-0411]YYYY" UTF8_CJ_YEAR "M" UTF8_CJ_MON "D" UTF8_CJ_DAY ),
1254 EXC_NUMFMT_STRING( 32, "[$-0411]h" UTF8_CJ_HOUR "mm" UTF8_CJ_MIN ),
1255 EXC_NUMFMT_STRING( 33, "[$-0411]h" UTF8_CJ_HOUR "mm" UTF8_CJ_MIN "ss" UTF8_CJ_SEC ),
1256 EXC_NUMFMT_STRING( 34, "[$-0411]YYYY" UTF8_CJ_YEAR "M" UTF8_CJ_MON ),
1257 EXC_NUMFMT_STRING( 35, "[$-0411]M" UTF8_CJ_MON "D" UTF8_CJ_DAY ),
1258 EXC_NUMFMT_STRING( 63, UTF8_YEN_JP "#,##0;-" UTF8_YEN_JP "#,##0" ),
1259 EXC_NUMFMT_STRING( 64, UTF8_YEN_JP "#,##0;[RED]-" UTF8_YEN_JP "#,##0" ),
1260 EXC_NUMFMT_STRING( 65, UTF8_YEN_JP "#,##0.00;-" UTF8_YEN_JP "#,##0.00" ),
1261 EXC_NUMFMT_STRING( 66, UTF8_YEN_JP "#,##0.00;[RED]-" UTF8_YEN_JP "#,##0.00" ),
1262 EXC_NUMFMT_ENDTABLE()
1265 static const XclBuiltInFormat spBuiltInFormats_KOREAN[] =
1267 EXC_NUMFMT_STRING( 14, "YYYY-MM-DD" ),
1268 EXC_NUMFMT_STRING( 15, "DD-MMM-YY" ),
1269 EXC_NUMFMT_STRING( 16, "DD-MMM" ),
1270 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1271 EXC_NUMFMT_STRING( 22, "YYYY-MM-DD h:mm" ),
1272 EXC_NUMFMT_STRING( 27, "[$-0412]YYYY" UTF8_CJ_YEAR " MM" UTF8_CJ_MON " DD" UTF8_CJ_DAY ),
1273 EXC_NUMFMT_STRING( 28, "[$-0412]MM-DD" ),
1274 EXC_NUMFMT_STRING( 30, "[$-0412]MM-DD-YY" ),
1275 EXC_NUMFMT_STRING( 31, "[$-0412]YYYY" UTF8_KO_YEAR " MM" UTF8_KO_MON " DD" UTF8_KO_DAY ),
1276 EXC_NUMFMT_STRING( 32, "[$-0412]h" UTF8_KO_HOUR " mm" UTF8_KO_MIN ),
1277 EXC_NUMFMT_STRING( 33, "[$-0412]h" UTF8_KO_HOUR " mm" UTF8_KO_MIN " ss" UTF8_KO_SEC ),
1278 EXC_NUMFMT_STRING( 34, "[$-0412]YYYY\"/\"MM\"/\"DD" ),
1279 EXC_NUMFMT_STRING( 35, "[$-0412]YYYY-MM-DD" ),
1280 EXC_NUMFMT_STRING( 63, UTF8_WON "#,##0;-" UTF8_WON "#,##0" ),
1281 EXC_NUMFMT_STRING( 64, UTF8_WON "#,##0;[RED]-" UTF8_WON "#,##0" ),
1282 EXC_NUMFMT_STRING( 65, UTF8_WON "#,##0.00;-" UTF8_WON "#,##0.00" ),
1283 EXC_NUMFMT_STRING( 66, UTF8_WON "#,##0.00;[RED]-" UTF8_WON "#,##0.00" ),
1284 EXC_NUMFMT_ENDTABLE()
1287 static const XclBuiltInFormat spBuiltInFormats_CHINESE_SIMPLIFIED[] =
1289 EXC_NUMFMT_STRING( 14, "YYYY-M-D" ),
1290 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1291 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1292 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1293 EXC_NUMFMT_STRING( 22, "YYYY-M-D h:mm" ),
1294 EXC_NUMFMT_STRING( 27, "[$-0804]YYYY" UTF8_CJ_YEAR "M" UTF8_CJ_MON ),
1295 EXC_NUMFMT_STRING( 28, "[$-0804]M" UTF8_CJ_MON "D" UTF8_CJ_DAY ),
1296 EXC_NUMFMT_STRING( 30, "[$-0804]M-D-YY" ),
1297 EXC_NUMFMT_STRING( 31, "[$-0804]YYYY" UTF8_CJ_YEAR "M" UTF8_CJ_MON "D" UTF8_CJ_DAY ),
1298 EXC_NUMFMT_STRING( 32, "[$-0804]h" UTF8_CS_HOUR "mm" UTF8_CJ_MIN ),
1299 EXC_NUMFMT_STRING( 33, "[$-0804]h" UTF8_CS_HOUR "mm" UTF8_CJ_MIN "ss" UTF8_CJ_SEC ),
1300 EXC_NUMFMT_STRING( 34, "[$-0804]AM/PMh" UTF8_CS_HOUR "mm" UTF8_CJ_MIN ),
1301 EXC_NUMFMT_STRING( 35, "[$-0804]AM/PMh" UTF8_CS_HOUR "mm" UTF8_CJ_MIN "ss" UTF8_CJ_SEC ),
1302 EXC_NUMFMT_REUSE( 52, 27 ),
1303 EXC_NUMFMT_REUSE( 53, 28 ),
1304 EXC_NUMFMT_STRING( 63, UTF8_YEN_CS "#,##0;-" UTF8_YEN_CS "#,##0" ),
1305 EXC_NUMFMT_STRING( 64, UTF8_YEN_CS "#,##0;[RED]-" UTF8_YEN_CS "#,##0" ),
1306 EXC_NUMFMT_STRING( 65, UTF8_YEN_CS "#,##0.00;-" UTF8_YEN_CS "#,##0.00" ),
1307 EXC_NUMFMT_STRING( 66, UTF8_YEN_CS "#,##0.00;[RED]-" UTF8_YEN_CS "#,##0.00" ),
1308 EXC_NUMFMT_ENDTABLE()
1311 static const XclBuiltInFormat spBuiltInFormats_CHINESE_TRADITIONAL[] =
1313 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1314 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1315 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1316 EXC_NUMFMT_STRING( 18, "hh:mm AM/PM" ),
1317 EXC_NUMFMT_STRING( 19, "hh:mm:ss AM/PM" ),
1318 EXC_NUMFMT_OFFSET( 20, NF_TIME_HHMM ),
1319 EXC_NUMFMT_OFFSET( 21, NF_TIME_HHMMSS ),
1320 EXC_NUMFMT_STRING( 22, "YYYY/M/D hh:mm" ),
1321 EXC_NUMFMT_STRING( 23, "US$#,##0_);(US$#,##0)" ),
1322 EXC_NUMFMT_STRING( 24, "US$#,##0_);[RED](US$#,##0)" ),
1323 EXC_NUMFMT_STRING( 25, "US$#,##0.00_);(US$#,##0.00)" ),
1324 EXC_NUMFMT_STRING( 26, "US$#,##0.00_);[RED](US$#,##0.00)" ),
1325 EXC_NUMFMT_STRING( 27, "[$-0404]E/M/D" ),
1326 EXC_NUMFMT_STRING( 28, "[$-0404]E" UTF8_CJ_YEAR "M" UTF8_CJ_MON "D" UTF8_CJ_DAY ),
1327 EXC_NUMFMT_STRING( 30, "[$-0404]M/D/YY" ),
1328 EXC_NUMFMT_STRING( 31, "[$-0404]YYYY" UTF8_CJ_YEAR "M" UTF8_CJ_MON "D" UTF8_CJ_DAY ),
1329 EXC_NUMFMT_STRING( 32, "[$-0404]hh" UTF8_CJ_HOUR "mm" UTF8_CJ_MIN ),
1330 EXC_NUMFMT_STRING( 33, "[$-0404]hh" UTF8_CJ_HOUR "mm" UTF8_CJ_MIN "ss" UTF8_CJ_SEC ),
1331 EXC_NUMFMT_STRING( 34, "[$-0404]AM/PMhh" UTF8_CJ_HOUR "mm" UTF8_CJ_MIN ),
1332 EXC_NUMFMT_STRING( 35, "[$-0404]AM/PMhh" UTF8_CJ_HOUR "mm" UTF8_CJ_MIN "ss" UTF8_CJ_SEC ),
1333 EXC_NUMFMT_STRING( 63, "$#,##0;-$#,##0" ),
1334 EXC_NUMFMT_STRING( 64, "$#,##0;[RED]-$#,##0" ),
1335 EXC_NUMFMT_STRING( 65, "$#,##0.00;-$#,##0.00" ),
1336 EXC_NUMFMT_STRING( 66, "$#,##0.00;[RED]-$#,##0.00" ),
1337 EXC_NUMFMT_ENDTABLE()
1340 // OTHER ----------------------------------------------------------------------
1342 static const XclBuiltInFormat spBuiltInFormats_HEBREW[] =
1344 EXC_NUMFMT_STRING( 15, "DD-MMMM-YY" ),
1345 EXC_NUMFMT_STRING( 16, "DD-MMMM" ),
1346 EXC_NUMFMT_STRING( 17, "MMMM-YY" ),
1347 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1348 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1349 EXC_NUMFMT_STRING( 63, UTF8_SHEQEL " #,##0;" UTF8_SHEQEL " -#,##0" ),
1350 EXC_NUMFMT_STRING( 64, UTF8_SHEQEL " #,##0;[RED]" UTF8_SHEQEL " -#,##0" ),
1351 EXC_NUMFMT_STRING( 65, UTF8_SHEQEL " #,##0.00;" UTF8_SHEQEL " -#,##0.00" ),
1352 EXC_NUMFMT_STRING( 66, UTF8_SHEQEL " #,##0.00;[RED]" UTF8_SHEQEL " -#,##0.00" ),
1353 EXC_NUMFMT_ENDTABLE()
1356 static const XclBuiltInFormat spBuiltInFormats_THAI[] =
1358 EXC_NUMFMT_STRING( 14, "D/M/YYYY" ),
1359 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1360 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1361 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1362 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1363 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1364 EXC_NUMFMT_STRING( 22, "D/M/YYYY h:mm" ),
1365 EXC_NUMFMT_STRING( 59, "t0" ),
1366 EXC_NUMFMT_STRING( 60, "t0.00" ),
1367 EXC_NUMFMT_STRING( 61, "t#,##0" ),
1368 EXC_NUMFMT_STRING( 62, "t#,##0.00" ),
1369 EXC_NUMFMT_STRING( 63, "t" UTF8_BAHT "#,##0_);t(" UTF8_BAHT "#,##0)" ),
1370 EXC_NUMFMT_STRING( 64, "t" UTF8_BAHT "#,##0_);[RED]t(" UTF8_BAHT "#,##0)" ),
1371 EXC_NUMFMT_STRING( 65, "t" UTF8_BAHT "#,##0.00_);t(" UTF8_BAHT "#,##0.00)" ),
1372 EXC_NUMFMT_STRING( 66, "t" UTF8_BAHT "#,##0.00_);[RED]t(" UTF8_BAHT "#,##0.00)" ),
1373 EXC_NUMFMT_STRING( 67, "t0%" ),
1374 EXC_NUMFMT_STRING( 68, "t0.00%" ),
1375 EXC_NUMFMT_STRING( 69, "t# ?/?" ),
1376 EXC_NUMFMT_STRING( 70, "t# ?\?/?\?" ),
1377 EXC_NUMFMT_STRING( 71, "tD/M/EE" ),
1378 EXC_NUMFMT_STRING( 72, "tD-MMM-E" ),
1379 EXC_NUMFMT_STRING( 73, "tD-MMM" ),
1380 EXC_NUMFMT_STRING( 74, "tMMM-E" ),
1381 EXC_NUMFMT_STRING( 75, "th:mm" ),
1382 EXC_NUMFMT_STRING( 76, "th:mm:ss" ),
1383 EXC_NUMFMT_STRING( 77, "tD/M/EE h:mm" ),
1384 EXC_NUMFMT_STRING( 78, "tmm:ss" ),
1385 EXC_NUMFMT_STRING( 79, "t[h]:mm:ss" ),
1386 EXC_NUMFMT_STRING( 80, "tmm:ss.0" ),
1387 EXC_NUMFMT_STRING( 81, "D/M/E" ),
1388 EXC_NUMFMT_ENDTABLE()
1391 #undef EXC_NUMFMT_ENDTABLE
1392 #undef EXC_NUMFMT_REUSE
1393 #undef EXC_NUMFMT_OFFSET
1394 #undef EXC_NUMFMT_STRING
1396 /** Specifies a number format table for a specific language. */
1397 struct XclBuiltInFormatTable
1399 LanguageType meLanguage; /// The language of this table.
1400 LanguageType meParentLang; /// The language of the parent table.
1401 const XclBuiltInFormat* mpFormats; /// The number format table.
1404 static const XclBuiltInFormatTable spBuiltInFormatTables[] =
1405 { // language parent language format table
1406 { LANGUAGE_DONTKNOW, LANGUAGE_NONE, spBuiltInFormats_DONTKNOW },
1408 { LANGUAGE_ENGLISH, LANGUAGE_DONTKNOW, spBuiltInFormats_ENGLISH },
1409 { LANGUAGE_ENGLISH_UK, LANGUAGE_ENGLISH, spBuiltInFormats_ENGLISH_UK },
1410 { LANGUAGE_ENGLISH_EIRE, LANGUAGE_ENGLISH, spBuiltInFormats_ENGLISH_EIRE },
1411 { LANGUAGE_ENGLISH_US, LANGUAGE_ENGLISH, spBuiltInFormats_ENGLISH_US },
1412 { LANGUAGE_ENGLISH_CAN, LANGUAGE_ENGLISH, spBuiltInFormats_ENGLISH_CAN },
1413 { LANGUAGE_ENGLISH_AUS, LANGUAGE_ENGLISH, spBuiltInFormats_ENGLISH_AUS },
1414 { LANGUAGE_ENGLISH_SAFRICA, LANGUAGE_ENGLISH, spBuiltInFormats_ENGLISH_SAFRICA },
1415 { LANGUAGE_ENGLISH_NZ, LANGUAGE_ENGLISH_AUS, 0 },
1417 { PRV_LANGUAGE_FRENCH_PRIM, LANGUAGE_DONTKNOW, spBuiltInFormats_FRENCH },
1418 { LANGUAGE_FRENCH, PRV_LANGUAGE_FRENCH_PRIM, spBuiltInFormats_FRENCH_FRANCE },
1419 { LANGUAGE_FRENCH_CANADIAN, PRV_LANGUAGE_FRENCH_PRIM, spBuiltInFormats_FRENCH_CANADIAN },
1420 { LANGUAGE_FRENCH_SWISS, PRV_LANGUAGE_FRENCH_PRIM, spBuiltInFormats_FRENCH_SWISS },
1421 { LANGUAGE_FRENCH_BELGIAN, LANGUAGE_FRENCH, spBuiltInFormats_FRENCH_BELGIAN },
1422 { LANGUAGE_FRENCH_LUXEMBOURG, LANGUAGE_FRENCH, 0 },
1423 { LANGUAGE_FRENCH_MONACO, LANGUAGE_FRENCH, 0 },
1425 { PRV_LANGUAGE_GERMAN_PRIM, LANGUAGE_DONTKNOW, spBuiltInFormats_GERMAN },
1426 { LANGUAGE_GERMAN, PRV_LANGUAGE_GERMAN_PRIM, spBuiltInFormats_GERMAN_GERMANY },
1427 { LANGUAGE_GERMAN_AUSTRIAN, PRV_LANGUAGE_GERMAN_PRIM, spBuiltInFormats_GERMAN_AUSTRIAN },
1428 { LANGUAGE_GERMAN_SWISS, PRV_LANGUAGE_GERMAN_PRIM, spBuiltInFormats_GERMAN_SWISS },
1429 { LANGUAGE_GERMAN_LUXEMBOURG, PRV_LANGUAGE_GERMAN_PRIM, spBuiltInFormats_GERMAN_LUXEMBOURG },
1430 { LANGUAGE_GERMAN_LIECHTENSTEIN, PRV_LANGUAGE_GERMAN_PRIM, spBuiltInFormats_GERMAN_LIECHTENSTEIN },
1432 { LANGUAGE_ITALIAN, LANGUAGE_DONTKNOW, spBuiltInFormats_ITALIAN_ITALY },
1433 { LANGUAGE_ITALIAN_SWISS, LANGUAGE_DONTKNOW, spBuiltInFormats_ITALIAN_SWISS },
1435 { LANGUAGE_SWEDISH, LANGUAGE_DONTKNOW, spBuiltInFormats_SWEDISH_SWEDEN },
1436 { LANGUAGE_SWEDISH_FINLAND, LANGUAGE_DONTKNOW, spBuiltInFormats_SWEDISH_FINLAND },
1438 { PRV_LANGUAGE_ASIAN_PRIM, LANGUAGE_DONTKNOW, spBuiltInFormats_ASIAN },
1439 { LANGUAGE_JAPANESE, PRV_LANGUAGE_ASIAN_PRIM, spBuiltInFormats_JAPANESE },
1440 { LANGUAGE_KOREAN, PRV_LANGUAGE_ASIAN_PRIM, spBuiltInFormats_KOREAN },
1441 { LANGUAGE_CHINESE_SIMPLIFIED, PRV_LANGUAGE_ASIAN_PRIM, spBuiltInFormats_CHINESE_SIMPLIFIED },
1442 { LANGUAGE_CHINESE_TRADITIONAL, PRV_LANGUAGE_ASIAN_PRIM, spBuiltInFormats_CHINESE_TRADITIONAL },
1444 { LANGUAGE_HEBREW, LANGUAGE_DONTKNOW, spBuiltInFormats_HEBREW },
1445 { LANGUAGE_THAI, LANGUAGE_DONTKNOW, spBuiltInFormats_THAI }
1448 } // namespace
1450 XclNumFmtBuffer::XclNumFmtBuffer( const XclRoot& rRoot ) :
1451 meSysLang( rRoot.GetSysLanguage() ),
1452 mnStdScNumFmt( rRoot.GetFormatter().GetStandardFormat( ScGlobal::eLnge ) )
1454 // *** insert default formats (BIFF5+ only)***
1456 if( rRoot.GetBiff() >= EXC_BIFF5 )
1457 InsertBuiltinFormats();
1460 void XclNumFmtBuffer::InitializeImport()
1462 maFmtMap.clear();
1465 void XclNumFmtBuffer::InsertFormat( sal_uInt16 nXclNumFmt, const OUString& rFormat )
1467 XclNumFmt& rNumFmt = maFmtMap[ nXclNumFmt ];
1468 rNumFmt.maFormat = rFormat;
1469 // #i62053# rFormat may be an empty string, meOffset must be initialized
1470 rNumFmt.meOffset = NF_NUMBER_STANDARD;
1471 rNumFmt.meLanguage = LANGUAGE_SYSTEM;
1474 void XclNumFmtBuffer::InsertBuiltinFormats()
1476 // build a map containing tables for all languages
1477 typedef ::std::map< LanguageType, const XclBuiltInFormatTable* > XclBuiltInMap;
1478 XclBuiltInMap aBuiltInMap;
1479 for( const XclBuiltInFormatTable* pTable = spBuiltInFormatTables;
1480 pTable != STATIC_ARRAY_END( spBuiltInFormatTables ); ++pTable )
1481 aBuiltInMap[ pTable->meLanguage ] = pTable;
1483 // build a list of table pointers for the current language, with all parent tables
1484 typedef ::std::vector< const XclBuiltInFormatTable* > XclBuiltInVec;
1485 XclBuiltInVec aBuiltInVec;
1486 for( XclBuiltInMap::const_iterator aMIt = aBuiltInMap.find( meSysLang ), aMEnd = aBuiltInMap.end();
1487 aMIt != aMEnd; aMIt = aBuiltInMap.find( aMIt->second->meParentLang ) )
1488 aBuiltInVec.push_back( aMIt->second );
1489 // language not supported
1490 if( aBuiltInVec.empty() )
1492 OSL_TRACE( "XclNumFmtBuffer::InsertBuiltinFormats - language 0x%04hX not supported (#i29949#)", meSysLang );
1493 XclBuiltInMap::const_iterator aMIt = aBuiltInMap.find( LANGUAGE_DONTKNOW );
1494 OSL_ENSURE( aMIt != aBuiltInMap.end(), "XclNumFmtBuffer::InsertBuiltinFormats - default map not found" );
1495 if( aMIt != aBuiltInMap.end() )
1496 aBuiltInVec.push_back( aMIt->second );
1499 // insert the default formats in the format map, from root parent to system language
1500 typedef ::std::map< sal_uInt16, sal_uInt16 > XclReuseMap;
1501 XclReuseMap aReuseMap;
1502 for( XclBuiltInVec::reverse_iterator aVIt = aBuiltInVec.rbegin(), aVEnd = aBuiltInVec.rend(); aVIt != aVEnd; ++aVIt )
1504 // put LANGUAGE_SYSTEM for all entries in default table
1505 LanguageType eLang = ((*aVIt)->meLanguage == LANGUAGE_DONTKNOW) ? LANGUAGE_SYSTEM : meSysLang;
1506 for( const XclBuiltInFormat* pBuiltIn = (*aVIt)->mpFormats; pBuiltIn && (pBuiltIn->mnXclNumFmt != EXC_FORMAT_NOTFOUND); ++pBuiltIn )
1508 XclNumFmt& rNumFmt = maFmtMap[ pBuiltIn->mnXclNumFmt ];
1510 rNumFmt.meOffset = pBuiltIn->meOffset;
1511 rNumFmt.meLanguage = eLang;
1513 if( pBuiltIn->mpFormat )
1514 rNumFmt.maFormat = OUString( pBuiltIn->mpFormat, strlen(pBuiltIn->mpFormat), RTL_TEXTENCODING_UTF8 );
1515 else
1516 rNumFmt.maFormat = EMPTY_OUSTRING;
1518 if( pBuiltIn->meOffset == PRV_NF_INDEX_REUSE )
1519 aReuseMap[ pBuiltIn->mnXclNumFmt ] = pBuiltIn->mnXclReuseFmt;
1520 else
1521 aReuseMap.erase( pBuiltIn->mnXclNumFmt );
1525 // copy reused number formats
1526 for( XclReuseMap::const_iterator aRIt = aReuseMap.begin(), aREnd = aReuseMap.end(); aRIt != aREnd; ++aRIt )
1527 maFmtMap[ aRIt->first ] = maFmtMap[ aRIt->second ];
1530 // Cell formatting data (XF) ==================================================
1532 XclCellProt::XclCellProt() :
1533 mbLocked( true ), // default in Excel and Calc
1534 mbHidden( false )
1538 bool operator==( const XclCellProt& rLeft, const XclCellProt& rRight )
1540 return (rLeft.mbLocked == rRight.mbLocked) && (rLeft.mbHidden == rRight.mbHidden);
1543 XclCellAlign::XclCellAlign() :
1544 mnHorAlign( EXC_XF_HOR_GENERAL ),
1545 mnVerAlign( EXC_XF_VER_BOTTOM ),
1546 mnOrient( EXC_ORIENT_NONE ),
1547 mnTextDir( EXC_XF_TEXTDIR_CONTEXT ),
1548 mnRotation( EXC_ROT_NONE ),
1549 mnIndent( 0 ),
1550 mbLineBreak( false ),
1551 mbShrink( false )
1555 SvxCellHorJustify XclCellAlign::GetScHorAlign() const
1557 SvxCellHorJustify eHorJust = SVX_HOR_JUSTIFY_STANDARD;
1558 switch( mnHorAlign )
1560 case EXC_XF_HOR_GENERAL: eHorJust = SVX_HOR_JUSTIFY_STANDARD; break;
1561 case EXC_XF_HOR_LEFT: eHorJust = SVX_HOR_JUSTIFY_LEFT; break;
1562 case EXC_XF_HOR_CENTER_AS:
1563 case EXC_XF_HOR_CENTER: eHorJust = SVX_HOR_JUSTIFY_CENTER; break;
1564 case EXC_XF_HOR_RIGHT: eHorJust = SVX_HOR_JUSTIFY_RIGHT; break;
1565 case EXC_XF_HOR_FILL: eHorJust = SVX_HOR_JUSTIFY_REPEAT; break;
1566 case EXC_XF_HOR_JUSTIFY:
1567 case EXC_XF_HOR_DISTRIB: eHorJust = SVX_HOR_JUSTIFY_BLOCK; break;
1568 default: OSL_FAIL( "XclCellAlign::GetScHorAlign - unknown horizontal alignment" );
1570 return eHorJust;
1573 SvxCellJustifyMethod XclCellAlign::GetScHorJustifyMethod() const
1575 return (mnHorAlign == EXC_XF_HOR_DISTRIB) ? SVX_JUSTIFY_METHOD_DISTRIBUTE : SVX_JUSTIFY_METHOD_AUTO;
1578 SvxCellVerJustify XclCellAlign::GetScVerAlign() const
1580 SvxCellVerJustify eVerJust = SVX_VER_JUSTIFY_STANDARD;
1581 switch( mnVerAlign )
1583 case EXC_XF_VER_TOP: eVerJust = SVX_VER_JUSTIFY_TOP; break;
1584 case EXC_XF_VER_CENTER: eVerJust = SVX_VER_JUSTIFY_CENTER; break;
1585 case EXC_XF_VER_BOTTOM: eVerJust = SVX_VER_JUSTIFY_STANDARD; break;
1586 case EXC_XF_VER_JUSTIFY:
1587 case EXC_XF_VER_DISTRIB: eVerJust = SVX_VER_JUSTIFY_BLOCK; break;
1588 default: OSL_FAIL( "XclCellAlign::GetScVerAlign - unknown vertical alignment" );
1590 return eVerJust;
1593 SvxCellJustifyMethod XclCellAlign::GetScVerJustifyMethod() const
1595 return (mnVerAlign == EXC_XF_VER_DISTRIB) ? SVX_JUSTIFY_METHOD_DISTRIBUTE : SVX_JUSTIFY_METHOD_AUTO;
1598 SvxFrameDirection XclCellAlign::GetScFrameDir() const
1600 SvxFrameDirection eFrameDir = FRMDIR_ENVIRONMENT;
1601 switch( mnTextDir )
1603 case EXC_XF_TEXTDIR_CONTEXT: eFrameDir = FRMDIR_ENVIRONMENT; break;
1604 case EXC_XF_TEXTDIR_LTR: eFrameDir = FRMDIR_HORI_LEFT_TOP; break;
1605 case EXC_XF_TEXTDIR_RTL: eFrameDir = FRMDIR_HORI_RIGHT_TOP; break;
1606 default: OSL_FAIL( "XclCellAlign::GetScFrameDir - unknown CTL text direction" );
1608 return eFrameDir;
1611 void XclCellAlign::SetScHorAlign( SvxCellHorJustify eHorJust )
1613 switch( eHorJust )
1615 case SVX_HOR_JUSTIFY_STANDARD: mnHorAlign = EXC_XF_HOR_GENERAL; break;
1616 case SVX_HOR_JUSTIFY_LEFT: mnHorAlign = EXC_XF_HOR_LEFT; break;
1617 case SVX_HOR_JUSTIFY_CENTER: mnHorAlign = EXC_XF_HOR_CENTER; break;
1618 case SVX_HOR_JUSTIFY_RIGHT: mnHorAlign = EXC_XF_HOR_RIGHT; break;
1619 case SVX_HOR_JUSTIFY_BLOCK: mnHorAlign = EXC_XF_HOR_JUSTIFY; break;
1620 case SVX_HOR_JUSTIFY_REPEAT: mnHorAlign = EXC_XF_HOR_FILL; break;
1621 default: mnHorAlign = EXC_XF_HOR_GENERAL;
1622 OSL_FAIL( "XclCellAlign::SetScHorAlign - unknown horizontal alignment" );
1626 void XclCellAlign::SetScVerAlign( SvxCellVerJustify eVerJust )
1628 switch( eVerJust )
1630 case SVX_VER_JUSTIFY_STANDARD: mnVerAlign = EXC_XF_VER_BOTTOM; break;
1631 case SVX_VER_JUSTIFY_TOP: mnVerAlign = EXC_XF_VER_TOP; break;
1632 case SVX_VER_JUSTIFY_CENTER: mnVerAlign = EXC_XF_VER_CENTER; break;
1633 case SVX_VER_JUSTIFY_BOTTOM: mnVerAlign = EXC_XF_VER_BOTTOM; break;
1634 default: mnVerAlign = EXC_XF_VER_BOTTOM;
1635 OSL_FAIL( "XclCellAlign::SetScVerAlign - unknown vertical alignment" );
1639 void XclCellAlign::SetScFrameDir( SvxFrameDirection eFrameDir )
1641 switch( eFrameDir )
1643 case FRMDIR_ENVIRONMENT: mnTextDir = EXC_XF_TEXTDIR_CONTEXT; break;
1644 case FRMDIR_HORI_LEFT_TOP: mnTextDir = EXC_XF_TEXTDIR_LTR; break;
1645 case FRMDIR_HORI_RIGHT_TOP: mnTextDir = EXC_XF_TEXTDIR_RTL; break;
1646 default: mnTextDir = EXC_XF_TEXTDIR_CONTEXT;
1647 OSL_FAIL( "XclCellAlign::SetScFrameDir - unknown CTL text direction" );
1651 bool operator==( const XclCellAlign& rLeft, const XclCellAlign& rRight )
1653 return
1654 (rLeft.mnHorAlign == rRight.mnHorAlign) && (rLeft.mnVerAlign == rRight.mnVerAlign) &&
1655 (rLeft.mnTextDir == rRight.mnTextDir) && (rLeft.mnOrient == rRight.mnOrient) &&
1656 (rLeft.mnRotation == rRight.mnRotation) && (rLeft.mnIndent == rRight.mnIndent) &&
1657 (rLeft.mbLineBreak == rRight.mbLineBreak) && (rLeft.mbShrink == rRight.mbShrink);
1660 XclCellBorder::XclCellBorder() :
1661 mnLeftColor( 0 ),
1662 mnRightColor( 0 ),
1663 mnTopColor( 0 ),
1664 mnBottomColor( 0 ),
1665 mnDiagColor( 0 ),
1666 mnLeftLine( EXC_LINE_NONE ),
1667 mnRightLine( EXC_LINE_NONE ),
1668 mnTopLine( EXC_LINE_NONE ),
1669 mnBottomLine( EXC_LINE_NONE ),
1670 mnDiagLine( EXC_LINE_NONE ),
1671 mbDiagTLtoBR( false ),
1672 mbDiagBLtoTR( false )
1676 bool operator==( const XclCellBorder& rLeft, const XclCellBorder& rRight )
1678 return
1679 (rLeft.mnLeftColor == rRight.mnLeftColor) && (rLeft.mnRightColor == rRight.mnRightColor) &&
1680 (rLeft.mnTopColor == rRight.mnTopColor) && (rLeft.mnBottomColor == rRight.mnBottomColor) &&
1681 (rLeft.mnLeftLine == rRight.mnLeftLine) && (rLeft.mnRightLine == rRight.mnRightLine) &&
1682 (rLeft.mnTopLine == rRight.mnTopLine) && (rLeft.mnBottomLine == rRight.mnBottomLine) &&
1683 (rLeft.mnDiagColor == rRight.mnDiagColor) && (rLeft.mnDiagLine == rRight.mnDiagLine) &&
1684 (rLeft.mbDiagTLtoBR == rRight.mbDiagTLtoBR) && (rLeft.mbDiagBLtoTR == rRight.mbDiagBLtoTR);
1687 XclCellArea::XclCellArea() :
1688 mnForeColor( EXC_COLOR_WINDOWTEXT ),
1689 mnBackColor( EXC_COLOR_WINDOWBACK ),
1690 mnPattern( EXC_PATT_NONE )
1694 bool XclCellArea::IsTransparent() const
1696 return (mnPattern == EXC_PATT_NONE) && (mnBackColor == EXC_COLOR_WINDOWBACK);
1699 bool operator==( const XclCellArea& rLeft, const XclCellArea& rRight )
1701 return
1702 (rLeft.mnForeColor == rRight.mnForeColor) && (rLeft.mnBackColor == rRight.mnBackColor) &&
1703 (rLeft.mnPattern == rRight.mnPattern);
1706 XclXFBase::XclXFBase( bool bCellXF ) :
1707 mnParent( bCellXF ? EXC_XF_DEFAULTSTYLE : EXC_XF_STYLEPARENT ),
1708 mbCellXF( bCellXF )
1710 SetAllUsedFlags( false );
1713 XclXFBase::~XclXFBase()
1717 void XclXFBase::SetAllUsedFlags( bool bUsed )
1719 mbProtUsed = mbFontUsed = mbFmtUsed = mbAlignUsed = mbBorderUsed = mbAreaUsed = bUsed;
1722 bool XclXFBase::HasUsedFlags() const
1724 return mbProtUsed || mbFontUsed || mbFmtUsed || mbAlignUsed || mbBorderUsed || mbAreaUsed;
1727 bool XclXFBase::Equals( const XclXFBase& rCmp ) const
1729 return
1730 (mbCellXF == rCmp.mbCellXF) && (mnParent == rCmp.mnParent) &&
1731 (mbProtUsed == rCmp.mbProtUsed) && (mbFontUsed == rCmp.mbFontUsed) &&
1732 (mbFmtUsed == rCmp.mbFmtUsed) && (mbAlignUsed == rCmp.mbAlignUsed) &&
1733 (mbBorderUsed == rCmp.mbBorderUsed) && (mbAreaUsed == rCmp.mbAreaUsed);
1736 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */