Update ooo320-m1
[ooovba.git] / sc / source / filter / excel / xlstyle.cxx
blob401f135b381ab0e380507874fd48892daafbb9fe
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: xlstyle.cxx,v $
10 * $Revision: 1.27.32.3 $
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 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
34 #include "xlstyle.hxx"
35 #include <com/sun/star/awt/FontFamily.hpp>
36 #include <com/sun/star/awt/FontSlant.hpp>
37 #include <com/sun/star/awt/FontUnderline.hpp>
38 #include <com/sun/star/i18n/ScriptType.hpp>
39 #include <vcl/svapp.hxx>
40 #include <vcl/font.hxx>
41 #include <rtl/tencinfo.h>
42 #include <toolkit/unohlp.hxx>
43 #include <svx/svxfont.hxx>
44 #include "global.hxx"
45 #include "xlroot.hxx"
47 // Color data =================================================================
49 /** Standard EGA colors, bright. */
50 #define EXC_PALETTE_EGA_COLORS_LIGHT \
51 0x000000, 0xFFFFFF, 0xFF0000, 0x00FF00, 0x0000FF, 0xFFFF00, 0xFF00FF, 0x00FFFF
52 /** Standard EGA colors, dark. */
53 #define EXC_PALETTE_EGA_COLORS_DARK \
54 0x800000, 0x008000, 0x000080, 0x808000, 0x800080, 0x008080, 0xC0C0C0, 0x808080
56 /** Default color table for BIFF2. */
57 static const ColorData spnDefColorTable2[] =
59 /* 0 */ EXC_PALETTE_EGA_COLORS_LIGHT
62 /** Default color table for BIFF3/BIFF4. */
63 static const ColorData spnDefColorTable3[] =
65 /* 0 */ EXC_PALETTE_EGA_COLORS_LIGHT,
66 /* 8 */ EXC_PALETTE_EGA_COLORS_LIGHT,
67 /* 16 */ EXC_PALETTE_EGA_COLORS_DARK
70 /** Default color table for BIFF5/BIFF7. */
71 static const ColorData spnDefColorTable5[] =
73 /* 0 */ EXC_PALETTE_EGA_COLORS_LIGHT,
74 /* 8 */ EXC_PALETTE_EGA_COLORS_LIGHT,
75 /* 16 */ EXC_PALETTE_EGA_COLORS_DARK,
76 /* 24 */ 0x8080FF, 0x802060, 0xFFFFC0, 0xA0E0E0, 0x600080, 0xFF8080, 0x0080C0, 0xC0C0FF,
77 /* 32 */ 0x000080, 0xFF00FF, 0xFFFF00, 0x00FFFF, 0x800080, 0x800000, 0x008080, 0x0000FF,
78 /* 40 */ 0x00CFFF, 0x69FFFF, 0xE0FFE0, 0xFFFF80, 0xA6CAF0, 0xDD9CB3, 0xB38FEE, 0xE3E3E3,
79 /* 48 */ 0x2A6FF9, 0x3FB8CD, 0x488436, 0x958C41, 0x8E5E42, 0xA0627A, 0x624FAC, 0x969696,
80 /* 56 */ 0x1D2FBE, 0x286676, 0x004500, 0x453E01, 0x6A2813, 0x85396A, 0x4A3285, 0x424242
83 /** Default color table for BIFF8. */
84 static const ColorData spnDefColorTable8[] =
86 /* 0 */ EXC_PALETTE_EGA_COLORS_LIGHT,
87 /* 8 */ EXC_PALETTE_EGA_COLORS_LIGHT,
88 /* 16 */ EXC_PALETTE_EGA_COLORS_DARK,
89 /* 24 */ 0x9999FF, 0x993366, 0xFFFFCC, 0xCCFFFF, 0x660066, 0xFF8080, 0x0066CC, 0xCCCCFF,
90 /* 32 */ 0x000080, 0xFF00FF, 0xFFFF00, 0x00FFFF, 0x800080, 0x800000, 0x008080, 0x0000FF,
91 /* 40 */ 0x00CCFF, 0xCCFFFF, 0xCCFFCC, 0xFFFF99, 0x99CCFF, 0xFF99CC, 0xCC99FF, 0xFFCC99,
92 /* 48 */ 0x3366FF, 0x33CCCC, 0x99CC00, 0xFFCC00, 0xFF9900, 0xFF6600, 0x666699, 0x969696,
93 /* 56 */ 0x003366, 0x339966, 0x003300, 0x333300, 0x993300, 0x993366, 0x333399, 0x333333
96 #undef EXC_PALETTE_EGA_COLORS_LIGHT
97 #undef EXC_PALETTE_EGA_COLORS_DARK
99 // ----------------------------------------------------------------------------
101 XclDefaultPalette::XclDefaultPalette( const XclRoot& rRoot ) :
102 mpnColorTable( 0 ),
103 mnTableSize( 0 )
105 const StyleSettings& rSett = Application::GetSettings().GetStyleSettings();
106 mnWindowText = rSett.GetWindowTextColor().GetColor();
107 mnWindowBack = rSett.GetWindowColor().GetColor();
108 mnFaceColor = rSett.GetFaceColor().GetColor();
109 mnNoteText = rSett.GetHelpTextColor().GetColor();
110 mnNoteBack = rSett.GetHelpColor().GetColor();
112 // default colors
113 switch( rRoot.GetBiff() )
115 case EXC_BIFF2:
116 mpnColorTable = spnDefColorTable2;
117 mnTableSize = STATIC_TABLE_SIZE( spnDefColorTable2 );
118 break;
119 case EXC_BIFF3:
120 case EXC_BIFF4:
121 mpnColorTable = spnDefColorTable3;
122 mnTableSize = STATIC_TABLE_SIZE( spnDefColorTable3 );
123 break;
124 case EXC_BIFF5:
125 mpnColorTable = spnDefColorTable5;
126 mnTableSize = STATIC_TABLE_SIZE( spnDefColorTable5 );
127 break;
128 case EXC_BIFF8:
129 mpnColorTable = spnDefColorTable8;
130 mnTableSize = STATIC_TABLE_SIZE( 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 DBG_ERROR1( "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 // ----------------------------------------------------------------------------
171 XclFontData::XclFontData()
173 Clear();
176 XclFontData::XclFontData( const Font& rFont )
178 Clear();
179 FillFromVclFont( rFont );
182 XclFontData::XclFontData( const SvxFont& rFont )
184 FillFromSvxFont( rFont );
187 void XclFontData::Clear()
189 maName.Erase();
190 maStyle.Erase();
191 maColor.SetColor( COL_AUTO );
192 mnHeight = 0;
193 mnWeight = EXC_FONTWGHT_DONTKNOW;
194 mnEscapem = EXC_FONTESC_NONE;
195 mnFamily = EXC_FONTFAM_SYSTEM;
196 mnCharSet = EXC_FONTCSET_ANSI_LATIN;
197 mnUnderline = EXC_FONTUNDERL_NONE;
198 mbItalic = mbStrikeout = mbOutline = mbShadow = false;
201 void XclFontData::FillFromVclFont( const Font& rFont )
203 maName = XclTools::GetXclFontName( rFont.GetName() ); // #106246# substitute with MS fonts
204 maStyle.Erase();
205 maColor = rFont.GetColor();
206 SetScUnderline( rFont.GetUnderline() );
207 mnEscapem = EXC_FONTESC_NONE;
208 SetScHeight( rFont.GetSize().Height() );
209 SetScWeight( rFont.GetWeight() );
210 SetScFamily( rFont.GetFamily() );
211 SetFontEncoding( rFont.GetCharSet() );
212 SetScPosture( rFont.GetItalic() );
213 SetScStrikeout( rFont.GetStrikeout() );
214 mbOutline = rFont.IsOutline();
215 mbShadow = rFont.IsShadow();
218 void XclFontData::FillFromSvxFont( const SvxFont& rFont )
220 FillFromVclFont( rFont );
221 SetScEscapement( rFont.GetEscapement() );
224 // *** conversion of VCL/SVX constants *** ------------------------------------
226 FontFamily XclFontData::GetScFamily( rtl_TextEncoding eDefTextEnc ) const
228 FontFamily eScFamily;
229 // ! format differs from Windows documentation: family is in lower nibble, pitch unknown
230 switch( mnFamily & 0x0F )
232 case EXC_FONTFAM_ROMAN: eScFamily = FAMILY_ROMAN; break;
233 case EXC_FONTFAM_SWISS: eScFamily = FAMILY_SWISS; break;
234 case EXC_FONTFAM_MODERN: eScFamily = FAMILY_MODERN; break;
235 case EXC_FONTFAM_SCRIPT: eScFamily = FAMILY_SCRIPT; break;
236 case EXC_FONTFAM_DECORATIVE: eScFamily = FAMILY_DECORATIVE; break;
237 default:
238 eScFamily =
239 ((eDefTextEnc == RTL_TEXTENCODING_APPLE_ROMAN) &&
240 (maName.EqualsIgnoreCaseAscii( "Geneva" ) || maName.EqualsIgnoreCaseAscii( "Chicago" ))) ?
241 FAMILY_SWISS : FAMILY_DONTKNOW;
243 return eScFamily;
246 rtl_TextEncoding XclFontData::GetFontEncoding() const
248 // convert Windows character set to text encoding identifier
249 return rtl_getTextEncodingFromWindowsCharset( mnCharSet );
252 FontItalic XclFontData::GetScPosture() const
254 return mbItalic ? ITALIC_NORMAL : ITALIC_NONE;
257 FontWeight XclFontData::GetScWeight() const
259 FontWeight eScWeight;
261 if( !mnWeight ) eScWeight = WEIGHT_DONTKNOW;
262 else if( mnWeight < 150 ) eScWeight = WEIGHT_THIN;
263 else if( mnWeight < 250 ) eScWeight = WEIGHT_ULTRALIGHT;
264 else if( mnWeight < 325 ) eScWeight = WEIGHT_LIGHT;
265 else if( mnWeight < 375 ) eScWeight = WEIGHT_SEMILIGHT;
266 else if( mnWeight < 450 ) eScWeight = WEIGHT_NORMAL;
267 else if( mnWeight < 550 ) eScWeight = WEIGHT_MEDIUM;
268 else if( mnWeight < 650 ) eScWeight = WEIGHT_SEMIBOLD;
269 else if( mnWeight < 750 ) eScWeight = WEIGHT_BOLD;
270 else if( mnWeight < 850 ) eScWeight = WEIGHT_ULTRABOLD;
271 else eScWeight = WEIGHT_BLACK;
273 return eScWeight;
276 FontUnderline XclFontData::GetScUnderline() const
278 FontUnderline eScUnderl = UNDERLINE_NONE;
279 switch( mnUnderline )
281 case EXC_FONTUNDERL_SINGLE:
282 case EXC_FONTUNDERL_SINGLE_ACC: eScUnderl = UNDERLINE_SINGLE; break;
283 case EXC_FONTUNDERL_DOUBLE:
284 case EXC_FONTUNDERL_DOUBLE_ACC: eScUnderl = UNDERLINE_DOUBLE; break;
286 return eScUnderl;
289 SvxEscapement XclFontData::GetScEscapement() const
291 SvxEscapement eScEscapem = SVX_ESCAPEMENT_OFF;
292 switch( mnEscapem )
294 case EXC_FONTESC_SUPER: eScEscapem = SVX_ESCAPEMENT_SUPERSCRIPT; break;
295 case EXC_FONTESC_SUB: eScEscapem = SVX_ESCAPEMENT_SUBSCRIPT; break;
297 return eScEscapem;
300 FontStrikeout XclFontData::GetScStrikeout() const
302 return mbStrikeout ? STRIKEOUT_SINGLE : STRIKEOUT_NONE;
305 void XclFontData::SetScHeight( sal_Int32 nTwips )
307 mnHeight = static_cast< sal_uInt16 >( ::std::min( nTwips, static_cast<sal_Int32>(0x7FFFL) ) );
310 void XclFontData::SetScFamily( FontFamily eScFamily )
312 switch( eScFamily )
314 case FAMILY_DONTKNOW: mnFamily = EXC_FONTFAM_DONTKNOW; break;
315 case FAMILY_DECORATIVE: mnFamily = EXC_FONTFAM_DECORATIVE; break;
316 case FAMILY_MODERN: mnFamily = EXC_FONTFAM_MODERN; break;
317 case FAMILY_ROMAN: mnFamily = EXC_FONTFAM_ROMAN; break;
318 case FAMILY_SCRIPT: mnFamily = EXC_FONTFAM_SCRIPT; break;
319 case FAMILY_SWISS: mnFamily = EXC_FONTFAM_SWISS; break;
320 case FAMILY_SYSTEM: mnFamily = EXC_FONTFAM_SYSTEM; break;
321 default:
322 DBG_ERRORFILE( "XclFontData::SetScFamily - unknown font family" );
323 mnFamily = EXC_FONTFAM_DONTKNOW;
327 void XclFontData::SetFontEncoding( rtl_TextEncoding eFontEnc )
329 // convert text encoding identifier to Windows character set
330 mnCharSet = rtl_getBestWindowsCharsetFromTextEncoding( eFontEnc );
334 void XclFontData::SetScPosture( FontItalic eScPosture )
336 mbItalic = (eScPosture == ITALIC_OBLIQUE) || (eScPosture == ITALIC_NORMAL);
339 void XclFontData::SetScWeight( FontWeight eScWeight )
341 switch( eScWeight )
343 case WEIGHT_DONTKNOW: mnWeight = EXC_FONTWGHT_DONTKNOW; break;
344 case WEIGHT_THIN: mnWeight = EXC_FONTWGHT_THIN; break;
345 case WEIGHT_ULTRALIGHT: mnWeight = EXC_FONTWGHT_ULTRALIGHT; break;
346 case WEIGHT_LIGHT: mnWeight = EXC_FONTWGHT_LIGHT; break;
347 case WEIGHT_SEMILIGHT: mnWeight = EXC_FONTWGHT_SEMILIGHT; break;
348 case WEIGHT_NORMAL: mnWeight = EXC_FONTWGHT_NORMAL; break;
349 case WEIGHT_MEDIUM: mnWeight = EXC_FONTWGHT_MEDIUM; break;
350 case WEIGHT_SEMIBOLD: mnWeight = EXC_FONTWGHT_SEMIBOLD; break;
351 case WEIGHT_BOLD: mnWeight = EXC_FONTWGHT_BOLD; break;
352 case WEIGHT_ULTRABOLD: mnWeight = EXC_FONTWGHT_ULTRABOLD; break;
353 case WEIGHT_BLACK: mnWeight = EXC_FONTWGHT_BLACK; break;
354 default: mnWeight = EXC_FONTWGHT_NORMAL;
358 void XclFontData::SetScUnderline( FontUnderline eScUnderl )
360 switch( eScUnderl )
362 case UNDERLINE_NONE:
363 case UNDERLINE_DONTKNOW: mnUnderline = EXC_FONTUNDERL_NONE; break;
364 case UNDERLINE_DOUBLE:
365 case UNDERLINE_DOUBLEWAVE: mnUnderline = EXC_FONTUNDERL_DOUBLE; break;
366 default: mnUnderline = EXC_FONTUNDERL_SINGLE;
370 void XclFontData::SetScEscapement( short nScEscapem )
372 if( nScEscapem > 0 )
373 mnEscapem = EXC_FONTESC_SUPER;
374 else if( nScEscapem < 0 )
375 mnEscapem = EXC_FONTESC_SUB;
376 else
377 mnEscapem = EXC_FONTESC_NONE;
380 void XclFontData::SetScStrikeout( FontStrikeout eScStrikeout )
382 mbStrikeout =
383 (eScStrikeout == STRIKEOUT_SINGLE) || (eScStrikeout == STRIKEOUT_DOUBLE) ||
384 (eScStrikeout == STRIKEOUT_BOLD) || (eScStrikeout == STRIKEOUT_SLASH) ||
385 (eScStrikeout == STRIKEOUT_X);
388 // *** conversion of API constants *** ----------------------------------------
390 float XclFontData::GetApiHeight() const
392 return static_cast< float >( mnHeight / TWIPS_PER_POINT );
395 sal_Int16 XclFontData::GetApiFamily() const
397 sal_Int16 nApiFamily = AwtFontFamily::DONTKNOW;
398 switch( mnFamily )
400 case FAMILY_DECORATIVE: nApiFamily = AwtFontFamily::DECORATIVE; break;
401 case FAMILY_MODERN: nApiFamily = AwtFontFamily::MODERN; break;
402 case FAMILY_ROMAN: nApiFamily = AwtFontFamily::ROMAN; break;
403 case FAMILY_SCRIPT: nApiFamily = AwtFontFamily::SCRIPT; break;
404 case FAMILY_SWISS: nApiFamily = AwtFontFamily::SWISS; break;
405 case FAMILY_SYSTEM: nApiFamily = AwtFontFamily::SYSTEM; break;
407 return nApiFamily;
410 sal_Int16 XclFontData::GetApiFontEncoding() const
412 // API constants are equal to rtl_TextEncoding constants
413 return static_cast< sal_Int16 >( GetFontEncoding() );
416 Awt::FontSlant XclFontData::GetApiPosture() const
418 return mbItalic ? Awt::FontSlant_ITALIC : Awt::FontSlant_NONE;
421 float XclFontData::GetApiWeight() const
423 return VCLUnoHelper::ConvertFontWeight( GetScWeight() );
426 sal_Int16 XclFontData::GetApiUnderline() const
428 sal_Int16 nApiUnderl = AwtFontUnderline::NONE;
429 switch( mnUnderline )
431 case EXC_FONTUNDERL_SINGLE:
432 case EXC_FONTUNDERL_SINGLE_ACC: nApiUnderl = AwtFontUnderline::SINGLE; break;
433 case EXC_FONTUNDERL_DOUBLE:
434 case EXC_FONTUNDERL_DOUBLE_ACC: nApiUnderl = AwtFontUnderline::DOUBLE; break;
436 return nApiUnderl;
439 sal_Int16 XclFontData::GetApiEscapement() const
441 sal_Int16 nApiEscapem = 0;
442 switch( mnEscapem )
444 case EXC_FONTESC_SUPER: nApiEscapem = 33; break;
445 case EXC_FONTESC_SUB: nApiEscapem = -33; break;
447 return nApiEscapem;
450 sal_Int16 XclFontData::GetApiStrikeout() const
452 return mbStrikeout ? AwtFontStrikeout::SINGLE : AwtFontStrikeout::NONE;
455 void XclFontData::SetApiHeight( float fPoint )
457 mnHeight = static_cast< sal_uInt16 >( ::std::min( fPoint * TWIPS_PER_POINT + 0.5, 32767.0 ) );
460 void XclFontData::SetApiFamily( sal_Int16 nApiFamily )
462 switch( nApiFamily )
464 case AwtFontFamily::DECORATIVE: mnFamily = FAMILY_DECORATIVE; break;
465 case AwtFontFamily::MODERN: mnFamily = FAMILY_MODERN; break;
466 case AwtFontFamily::ROMAN: mnFamily = FAMILY_ROMAN; break;
467 case AwtFontFamily::SCRIPT: mnFamily = FAMILY_SCRIPT; break;
468 case AwtFontFamily::SWISS: mnFamily = FAMILY_SWISS; break;
469 case AwtFontFamily::SYSTEM: mnFamily = FAMILY_SYSTEM; break;
470 default: mnFamily = FAMILY_DONTKNOW;
474 //UNUSED2009-05 void XclFontData::SetApiFontEncoding( sal_Int16 nApiFontEnc )
475 //UNUSED2009-05 {
476 //UNUSED2009-05 // API constants are equal to rtl_TextEncoding constants
477 //UNUSED2009-05 SetFontEncoding( static_cast< rtl_TextEncoding >( nApiFontEnc ) );
478 //UNUSED2009-05 }
480 void XclFontData::SetApiPosture( Awt::FontSlant eApiPosture )
482 mbItalic =
483 (eApiPosture == Awt::FontSlant_OBLIQUE) ||
484 (eApiPosture == Awt::FontSlant_ITALIC) ||
485 (eApiPosture == Awt::FontSlant_REVERSE_OBLIQUE) ||
486 (eApiPosture == Awt::FontSlant_REVERSE_ITALIC);
489 void XclFontData::SetApiWeight( float fApiWeight )
491 SetScWeight( VCLUnoHelper::ConvertFontWeight( fApiWeight ) );
494 void XclFontData::SetApiUnderline( sal_Int16 nApiUnderl )
496 switch( nApiUnderl )
498 case AwtFontUnderline::NONE:
499 case AwtFontUnderline::DONTKNOW: mnUnderline = EXC_FONTUNDERL_NONE; break;
500 case AwtFontUnderline::DOUBLE:
501 case AwtFontUnderline::DOUBLEWAVE: mnUnderline = EXC_FONTUNDERL_DOUBLE; break;
502 default: mnUnderline = EXC_FONTUNDERL_SINGLE;
506 void XclFontData::SetApiEscapement( sal_Int16 nApiEscapem )
508 if( nApiEscapem > 0 )
509 mnEscapem = EXC_FONTESC_SUPER;
510 else if( nApiEscapem < 0 )
511 mnEscapem = EXC_FONTESC_SUB;
512 else
513 mnEscapem = EXC_FONTESC_NONE;
516 void XclFontData::SetApiStrikeout( sal_Int16 nApiStrikeout )
518 mbStrikeout =
519 (nApiStrikeout != AwtFontStrikeout::NONE) &&
520 (nApiStrikeout != AwtFontStrikeout::DONTKNOW);
523 // ----------------------------------------------------------------------------
525 bool operator==( const XclFontData& rLeft, const XclFontData& rRight )
527 return
528 (rLeft.mnHeight == rRight.mnHeight) &&
529 (rLeft.mnWeight == rRight.mnWeight) &&
530 (rLeft.mnUnderline == rRight.mnUnderline) &&
531 (rLeft.maColor == rRight.maColor) &&
532 (rLeft.mnEscapem == rRight.mnEscapem) &&
533 (rLeft.mnFamily == rRight.mnFamily) &&
534 (rLeft.mnCharSet == rRight.mnCharSet) &&
535 (rLeft.mbItalic == rRight.mbItalic) &&
536 (rLeft.mbStrikeout == rRight.mbStrikeout) &&
537 (rLeft.mbOutline == rRight.mbOutline) &&
538 (rLeft.mbShadow == rRight.mbShadow) &&
539 (rLeft.maName == rRight.maName);
542 // ----------------------------------------------------------------------------
544 namespace {
546 /** Property names for common font settings. */
547 const sal_Char *const sppcPropNamesChCommon[] =
549 "CharUnderline", "CharStrikeout", "CharColor", "CharContoured", "CharShadowed", 0
551 /** Property names for Western font settings. */
552 const sal_Char *const sppcPropNamesChWstrn[] =
554 "CharFontName", "CharHeight", "CharPosture", "CharWeight", 0
556 /** Property names for Asian font settings. */
557 const sal_Char *const sppcPropNamesChAsian[] =
559 "CharFontNameAsian", "CharHeightAsian", "CharPostureAsian", "CharWeightAsian", 0
561 /** Property names for Complex font settings. */
562 const sal_Char *const sppcPropNamesChCmplx[] =
564 "CharFontNameComplex", "CharHeightComplex", "CharPostureComplex", "CharWeightComplex", 0
566 /** Property names for escapement. */
567 const sal_Char *const sppcPropNamesChEscapement[] =
569 "CharEscapement", "CharEscapementHeight", 0
571 const sal_Int8 EXC_API_ESC_HEIGHT = 58; /// Default escapement font height.
573 /** Property names for Western font settings without font name. */
574 const sal_Char *const *const sppcPropNamesChWstrnNoName = sppcPropNamesChWstrn + 1;
575 /** Property names for Asian font settings without font name. */
576 const sal_Char *const *const sppcPropNamesChAsianNoName = sppcPropNamesChAsian + 1;
577 /** Property names for Complex font settings without font name. */
578 const sal_Char *const *const sppcPropNamesChCmplxNoName = sppcPropNamesChCmplx + 1;
580 /** Property names for font settings in form controls. */
581 const sal_Char *const sppcPropNamesControl[] =
583 "FontName", "FontFamily", "FontCharset", "FontHeight", "FontSlant",
584 "FontWeight", "FontUnderline", "FontStrikeout", "TextColor", 0
587 /** Inserts all passed API font settings into the font data object. */
588 void lclSetApiFontSettings( XclFontData& rFontData,
589 const String& rApiFontName, float fApiHeight, float fApiWeight,
590 Awt::FontSlant eApiPosture, sal_Int16 nApiUnderl, sal_Int16 nApiStrikeout )
592 rFontData.maName = XclTools::GetXclFontName( rApiFontName );
593 rFontData.SetApiHeight( fApiHeight );
594 rFontData.SetApiWeight( fApiWeight );
595 rFontData.SetApiPosture( eApiPosture );
596 rFontData.SetApiUnderline( nApiUnderl );
597 rFontData.SetApiStrikeout( nApiStrikeout );
600 /** Writes script dependent properties to a font property set helper. */
601 void lclWriteChartFont( ScfPropertySet& rPropSet,
602 ScfPropSetHelper& rHlpName, ScfPropSetHelper& rHlpNoName,
603 const XclFontData& rFontData, bool bHasFontName )
605 // select the font helper
606 ScfPropSetHelper& rPropSetHlp = bHasFontName ? rHlpName : rHlpNoName;
607 // initialize the font helper (must be called before writing any properties)
608 rPropSetHlp.InitializeWrite();
609 // write font name
610 if( bHasFontName )
611 rPropSetHlp << rFontData.maName;
612 // write remaining properties
613 rPropSetHlp << rFontData.GetApiHeight() << rFontData.GetApiPosture() << rFontData.GetApiWeight();
614 // write properties to property set
615 rPropSetHlp.WriteToPropertySet( rPropSet );
618 } // namespace
620 // ----------------------------------------------------------------------------
622 XclFontPropSetHelper::XclFontPropSetHelper() :
623 maHlpChCommon( sppcPropNamesChCommon ),
624 maHlpChWstrn( sppcPropNamesChWstrn ),
625 maHlpChAsian( sppcPropNamesChAsian ),
626 maHlpChCmplx( sppcPropNamesChCmplx ),
627 maHlpChWstrnNoName( sppcPropNamesChWstrnNoName ),
628 maHlpChAsianNoName( sppcPropNamesChAsianNoName ),
629 maHlpChCmplxNoName( sppcPropNamesChCmplxNoName ),
630 maHlpChEscapement( sppcPropNamesChEscapement ),
631 maHlpControl( sppcPropNamesControl )
635 void XclFontPropSetHelper::ReadFontProperties( XclFontData& rFontData,
636 const ScfPropertySet& rPropSet, XclFontPropSetType eType, sal_Int16 nScript )
638 switch( eType )
640 case EXC_FONTPROPSET_CHART:
642 String aApiFontName;
643 float fApiHeight, fApiWeight;
644 sal_Int16 nApiUnderl = 0, nApiStrikeout = 0;
645 Awt::FontSlant eApiPosture;
647 // read script type dependent properties
648 ScfPropSetHelper& rPropSetHlp = GetChartHelper( nScript );
649 rPropSetHlp.ReadFromPropertySet( rPropSet );
650 rPropSetHlp >> aApiFontName >> fApiHeight >> eApiPosture >> fApiWeight;
651 // read common properties
652 maHlpChCommon.ReadFromPropertySet( rPropSet );
653 maHlpChCommon >> nApiUnderl
654 >> nApiStrikeout
655 >> rFontData.maColor
656 >> rFontData.mbOutline
657 >> rFontData.mbShadow;
659 // convert API property values to Excel settings
660 lclSetApiFontSettings( rFontData, aApiFontName,
661 fApiHeight, fApiWeight, eApiPosture, nApiUnderl, nApiStrikeout );
663 // font escapement
664 sal_Int16 nApiEscapement = 0;
665 sal_Int8 nApiEscHeight = 0;
666 maHlpChEscapement.ReadFromPropertySet( rPropSet );
667 maHlpChEscapement.ReadFromPropertySet( rPropSet );
668 maHlpChEscapement.ReadFromPropertySet( rPropSet );
669 maHlpChEscapement >> nApiEscapement >> nApiEscHeight;
670 rFontData.SetApiEscapement( nApiEscapement );
672 break;
674 case EXC_FONTPROPSET_CONTROL:
676 String aApiFontName;
677 float fApiHeight, fApiWeight;
678 sal_Int16 nApiFamily, nApiCharSet, nApiPosture, nApiUnderl, nApiStrikeout;
680 // read font properties
681 maHlpControl.ReadFromPropertySet( rPropSet );
682 maHlpControl >> aApiFontName
683 >> nApiFamily
684 >> nApiCharSet
685 >> fApiHeight
686 >> nApiPosture
687 >> fApiWeight
688 >> nApiUnderl
689 >> nApiStrikeout
690 >> rFontData.maColor;
692 // convert API property values to Excel settings
693 Awt::FontSlant eApiPosture = static_cast< Awt::FontSlant >( nApiPosture );
694 lclSetApiFontSettings( rFontData, aApiFontName,
695 fApiHeight, fApiWeight, eApiPosture, nApiUnderl, nApiStrikeout );
696 rFontData.SetApiFamily( nApiFamily );
697 rFontData.SetFontEncoding( nApiCharSet );
699 break;
703 void XclFontPropSetHelper::WriteFontProperties(
704 ScfPropertySet& rPropSet, XclFontPropSetType eType,
705 const XclFontData& rFontData, bool bHasWstrn, bool bHasAsian, bool bHasCmplx,
706 const Color* pFontColor )
708 switch( eType )
710 case EXC_FONTPROPSET_CHART:
712 // write common properties
713 maHlpChCommon.InitializeWrite();
714 const Color& rColor = pFontColor ? *pFontColor : rFontData.maColor;
715 maHlpChCommon << rFontData.GetApiUnderline()
716 << rFontData.GetApiStrikeout()
717 << rColor
718 << rFontData.mbOutline
719 << rFontData.mbShadow;
720 maHlpChCommon.WriteToPropertySet( rPropSet );
722 // write script type dependent properties
723 lclWriteChartFont( rPropSet, maHlpChWstrn, maHlpChWstrnNoName, rFontData, bHasWstrn );
724 lclWriteChartFont( rPropSet, maHlpChAsian, maHlpChAsianNoName, rFontData, bHasAsian );
725 lclWriteChartFont( rPropSet, maHlpChCmplx, maHlpChCmplxNoName, rFontData, bHasCmplx );
727 // font escapement
728 if( rFontData.GetScEscapement() != SVX_ESCAPEMENT_OFF )
730 maHlpChEscapement.InitializeWrite();
731 maHlpChEscapement << rFontData.GetApiEscapement() << EXC_API_ESC_HEIGHT;
732 maHlpChEscapement.WriteToPropertySet( rPropSet );
735 break;
737 case EXC_FONTPROPSET_CONTROL:
739 maHlpControl.InitializeWrite();
740 maHlpControl << rFontData.maName
741 << rFontData.GetApiFamily()
742 << rFontData.GetApiFontEncoding()
743 << static_cast< sal_Int16 >( rFontData.GetApiHeight() + 0.5 )
744 << rFontData.GetApiPosture()
745 << rFontData.GetApiWeight()
746 << rFontData.GetApiUnderline()
747 << rFontData.GetApiStrikeout()
748 << rFontData.maColor;
749 maHlpControl.WriteToPropertySet( rPropSet );
751 break;
755 ScfPropSetHelper& XclFontPropSetHelper::GetChartHelper( sal_Int16 nScript )
757 namespace ApiScriptType = ::com::sun::star::i18n::ScriptType;
758 switch( nScript )
760 case ApiScriptType::LATIN: return maHlpChWstrn;
761 case ApiScriptType::ASIAN: return maHlpChAsian;
762 case ApiScriptType::COMPLEX: return maHlpChCmplx;
763 default: DBG_ERRORFILE( "XclFontPropSetHelper::GetChartHelper - unknown script type" );
765 return maHlpChWstrn;
768 // Number formats =============================================================
770 namespace {
772 // ----------------------------------------------------------------------------
774 /** Special number format index describing a reused format. */
775 const NfIndexTableOffset PRV_NF_INDEX_REUSE = NF_INDEX_TABLE_ENTRIES;
777 /** German primary language not defined, LANGUAGE_GERMAN belongs to Germany. */
778 const LanguageType PRV_LANGUAGE_GERMAN_PRIM = LANGUAGE_GERMAN & LANGUAGE_MASK_PRIMARY;
779 /** French primary language not defined, LANGUAGE_FRENCH belongs to France. */
780 const LanguageType PRV_LANGUAGE_FRENCH_PRIM = LANGUAGE_FRENCH & LANGUAGE_MASK_PRIMARY;
781 /** Parent language identifier for Asian languages (LANGUAGE_CHINESE is a primary only ID). */
782 const LanguageType PRV_LANGUAGE_ASIAN_PRIM = LANGUAGE_CHINESE;
784 // ----------------------------------------------------------------------------
786 /** Stores the number format used in Calc for an Excel built-in number format. */
787 struct XclBuiltInFormat
789 sal_uInt16 mnXclNumFmt; /// Excel built-in index.
790 const sal_Char* mpFormat; /// Format string, may be 0 (meOffset used then).
791 NfIndexTableOffset meOffset; /// SvNumberFormatter format index, if mpFormat==0.
792 sal_uInt16 mnXclReuseFmt; /// Use this Excel format, if meOffset==PRV_NF_INDEX_REUSE.
795 // ----------------------------------------------------------------------------
797 /** Defines a literal Excel built-in number format. */
798 #define EXC_NUMFMT_STRING( nXclNumFmt, pcUtf8 ) \
799 { nXclNumFmt, pcUtf8, NF_NUMBER_STANDARD, 0 }
801 /** Defines an Excel built-in number format that maps to an own built-in format. */
802 #define EXC_NUMFMT_OFFSET( nXclNumFmt, eOffset ) \
803 { nXclNumFmt, 0, eOffset, 0 }
805 /** Defines an Excel built-in number format that is the same as the specified. */
806 #define EXC_NUMFMT_REUSE( nXclNumFmt, nXclReuse ) \
807 { nXclNumFmt, 0, PRV_NF_INDEX_REUSE, nXclReuse }
809 /** Terminates an Excel built-in number format table. */
810 #define EXC_NUMFMT_ENDTABLE() \
811 { EXC_FORMAT_NOTFOUND, 0, NF_NUMBER_STANDARD, 0 }
813 // ----------------------------------------------------------------------------
815 // Currency unit characters
816 #define UTF8_BAHT "\340\270\277"
817 #define UTF8_EURO "\342\202\254"
818 #define UTF8_POUND_UK "\302\243"
819 #define UTF8_SHEQEL "\342\202\252"
820 #define UTF8_WON "\357\277\246"
821 #define UTF8_YEN_CS "\357\277\245"
822 #define UTF8_YEN_JP "\302\245"
824 // Japanese/Chinese date/time characters
825 #define UTF8_CJ_YEAR "\345\271\264"
826 #define UTF8_CJ_MON "\346\234\210"
827 #define UTF8_CJ_DAY "\346\227\245"
828 #define UTF8_CJ_HOUR "\346\231\202"
829 #define UTF8_CJ_MIN "\345\210\206"
830 #define UTF8_CJ_SEC "\347\247\222"
832 // Chinese Simplified date/time characters
833 #define UTF8_CS_HOUR "\346\227\266"
835 // Korean date/time characters
836 #define UTF8_KO_YEAR "\353\205\204"
837 #define UTF8_KO_MON "\354\233\224"
838 #define UTF8_KO_DAY "\354\235\274"
839 #define UTF8_KO_HOUR "\354\213\234"
840 #define UTF8_KO_MIN "\353\266\204"
841 #define UTF8_KO_SEC "\354\264\210"
843 // ----------------------------------------------------------------------------
845 /** Default number format table. Last parent of all other tables, used for unknown languages. */
846 static const XclBuiltInFormat spBuiltInFormats_DONTKNOW[] =
848 EXC_NUMFMT_OFFSET( 0, NF_NUMBER_STANDARD ), // General
849 EXC_NUMFMT_OFFSET( 1, NF_NUMBER_INT ), // 0
850 EXC_NUMFMT_OFFSET( 2, NF_NUMBER_DEC2 ), // 0.00
851 EXC_NUMFMT_OFFSET( 3, NF_NUMBER_1000INT ), // #,##0
852 EXC_NUMFMT_OFFSET( 4, NF_NUMBER_1000DEC2 ), // #,##0.00
853 // 5...8 contained in file
854 EXC_NUMFMT_OFFSET( 9, NF_PERCENT_INT ), // 0%
855 EXC_NUMFMT_OFFSET( 10, NF_PERCENT_DEC2 ), // 0.00%
856 EXC_NUMFMT_OFFSET( 11, NF_SCIENTIFIC_000E00 ), // 0.00E+00
857 EXC_NUMFMT_OFFSET( 12, NF_FRACTION_1 ), // # ?/?
858 EXC_NUMFMT_OFFSET( 13, NF_FRACTION_2 ), // # ??/??
860 // 14...22 date and time formats
861 EXC_NUMFMT_OFFSET( 14, NF_DATE_SYS_DDMMYYYY ),
862 EXC_NUMFMT_OFFSET( 15, NF_DATE_SYS_DMMMYY ),
863 EXC_NUMFMT_OFFSET( 16, NF_DATE_SYS_DDMMM ),
864 EXC_NUMFMT_OFFSET( 17, NF_DATE_SYS_MMYY ),
865 EXC_NUMFMT_OFFSET( 18, NF_TIME_HHMMAMPM ),
866 EXC_NUMFMT_OFFSET( 19, NF_TIME_HHMMSSAMPM ),
867 EXC_NUMFMT_OFFSET( 20, NF_TIME_HHMM ),
868 EXC_NUMFMT_OFFSET( 21, NF_TIME_HHMMSS ),
869 EXC_NUMFMT_OFFSET( 22, NF_DATETIME_SYSTEM_SHORT_HHMM ),
871 // 23...36 international formats
872 EXC_NUMFMT_REUSE( 23, 0 ),
873 EXC_NUMFMT_REUSE( 24, 0 ),
874 EXC_NUMFMT_REUSE( 25, 0 ),
875 EXC_NUMFMT_REUSE( 26, 0 ),
876 EXC_NUMFMT_REUSE( 27, 14 ),
877 EXC_NUMFMT_REUSE( 28, 14 ),
878 EXC_NUMFMT_REUSE( 29, 14 ),
879 EXC_NUMFMT_REUSE( 30, 14 ),
880 EXC_NUMFMT_REUSE( 31, 14 ),
881 EXC_NUMFMT_REUSE( 32, 21 ),
882 EXC_NUMFMT_REUSE( 33, 21 ),
883 EXC_NUMFMT_REUSE( 34, 21 ),
884 EXC_NUMFMT_REUSE( 35, 21 ),
885 EXC_NUMFMT_REUSE( 36, 14 ),
887 // 37...44 accounting formats
888 // 41...44 contained in file
889 EXC_NUMFMT_STRING( 37, "#,##0;-#,##0" ),
890 EXC_NUMFMT_STRING( 38, "#,##0;[RED]-#,##0" ),
891 EXC_NUMFMT_STRING( 39, "#,##0.00;-#,##0.00" ),
892 EXC_NUMFMT_STRING( 40, "#,##0.00;[RED]-#,##0.00" ),
894 // 45...49 more special formats
895 EXC_NUMFMT_STRING( 45, "mm:ss" ),
896 EXC_NUMFMT_STRING( 46, "[h]:mm:ss" ),
897 EXC_NUMFMT_STRING( 47, "mm:ss.0" ),
898 EXC_NUMFMT_STRING( 48, "##0.0E+0" ),
899 EXC_NUMFMT_OFFSET( 49, NF_TEXT ),
901 // 50...81 international formats
902 EXC_NUMFMT_REUSE( 50, 14 ),
903 EXC_NUMFMT_REUSE( 51, 14 ),
904 EXC_NUMFMT_REUSE( 52, 14 ),
905 EXC_NUMFMT_REUSE( 53, 14 ),
906 EXC_NUMFMT_REUSE( 54, 14 ),
907 EXC_NUMFMT_REUSE( 55, 14 ),
908 EXC_NUMFMT_REUSE( 56, 14 ),
909 EXC_NUMFMT_REUSE( 57, 14 ),
910 EXC_NUMFMT_REUSE( 58, 14 ),
911 EXC_NUMFMT_REUSE( 59, 1 ),
912 EXC_NUMFMT_REUSE( 60, 2 ),
913 EXC_NUMFMT_REUSE( 61, 3 ),
914 EXC_NUMFMT_REUSE( 62, 4 ),
915 EXC_NUMFMT_REUSE( 67, 9 ),
916 EXC_NUMFMT_REUSE( 68, 10 ),
917 EXC_NUMFMT_REUSE( 69, 12 ),
918 EXC_NUMFMT_REUSE( 70, 13 ),
919 EXC_NUMFMT_REUSE( 71, 14 ),
920 EXC_NUMFMT_REUSE( 72, 14 ),
921 EXC_NUMFMT_REUSE( 73, 15 ),
922 EXC_NUMFMT_REUSE( 74, 16 ),
923 EXC_NUMFMT_REUSE( 75, 17 ),
924 EXC_NUMFMT_REUSE( 76, 20 ),
925 EXC_NUMFMT_REUSE( 77, 21 ),
926 EXC_NUMFMT_REUSE( 78, 22 ),
927 EXC_NUMFMT_REUSE( 79, 45 ),
928 EXC_NUMFMT_REUSE( 80, 46 ),
929 EXC_NUMFMT_REUSE( 81, 47 ),
931 // 82...163 not used, must not occur in a file (Excel may crash)
933 EXC_NUMFMT_ENDTABLE()
936 // ENGLISH --------------------------------------------------------------------
938 /** Base table for English locales. */
939 static const XclBuiltInFormat spBuiltInFormats_ENGLISH[] =
941 EXC_NUMFMT_STRING( 15, "DD-MMM-YY" ),
942 EXC_NUMFMT_STRING( 16, "DD-MMM" ),
943 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
944 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
945 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
946 EXC_NUMFMT_STRING( 22, "DD/MM/YYYY hh:mm" ),
947 EXC_NUMFMT_ENDTABLE()
950 static const XclBuiltInFormat spBuiltInFormats_ENGLISH_UK[] =
952 EXC_NUMFMT_STRING( 63, UTF8_POUND_UK "#,##0;-" UTF8_POUND_UK "#,##0" ),
953 EXC_NUMFMT_STRING( 64, UTF8_POUND_UK "#,##0;[RED]-" UTF8_POUND_UK "#,##0" ),
954 EXC_NUMFMT_STRING( 65, UTF8_POUND_UK "#,##0.00;-" UTF8_POUND_UK "#,##0.00" ),
955 EXC_NUMFMT_STRING( 66, UTF8_POUND_UK "#,##0.00;[RED]-" UTF8_POUND_UK "#,##0.00" ),
956 EXC_NUMFMT_ENDTABLE()
959 static const XclBuiltInFormat spBuiltInFormats_ENGLISH_EIRE[] =
961 EXC_NUMFMT_STRING( 63, UTF8_EURO "#,##0;-" UTF8_EURO "#,##0" ),
962 EXC_NUMFMT_STRING( 64, UTF8_EURO "#,##0;[RED]-" UTF8_EURO "#,##0" ),
963 EXC_NUMFMT_STRING( 65, UTF8_EURO "#,##0.00;-" UTF8_EURO "#,##0.00" ),
964 EXC_NUMFMT_STRING( 66, UTF8_EURO "#,##0.00;[RED]-" UTF8_EURO "#,##0.00" ),
965 EXC_NUMFMT_ENDTABLE()
968 static const XclBuiltInFormat spBuiltInFormats_ENGLISH_US[] =
970 EXC_NUMFMT_STRING( 14, "M/D/YYYY" ),
971 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
972 EXC_NUMFMT_STRING( 16, "D-MMM" ),
973 EXC_NUMFMT_STRING( 20, "h:mm" ),
974 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
975 EXC_NUMFMT_STRING( 22, "M/D/YYYY h:mm" ),
976 EXC_NUMFMT_STRING( 37, "#,##0_);(#,##0)" ),
977 EXC_NUMFMT_STRING( 38, "#,##0_);[RED](#,##0)" ),
978 EXC_NUMFMT_STRING( 39, "#,##0.00_);(#,##0.00)" ),
979 EXC_NUMFMT_STRING( 40, "#,##0.00_);[RED](#,##0.00)" ),
980 EXC_NUMFMT_STRING( 63, "$#,##0_);($#,##0)" ),
981 EXC_NUMFMT_STRING( 64, "$#,##0_);[RED]($#,##0)" ),
982 EXC_NUMFMT_STRING( 65, "$#,##0.00_);($#,##0.00)" ),
983 EXC_NUMFMT_STRING( 66, "$#,##0.00_);[RED]($#,##0.00)" ),
984 EXC_NUMFMT_ENDTABLE()
987 static const XclBuiltInFormat spBuiltInFormats_ENGLISH_CAN[] =
989 EXC_NUMFMT_STRING( 20, "h:mm" ),
990 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
991 EXC_NUMFMT_STRING( 22, "DD/MM/YYYY h:mm" ),
992 EXC_NUMFMT_STRING( 63, "$#,##0;-$#,##0" ),
993 EXC_NUMFMT_STRING( 64, "$#,##0;[RED]-$#,##0" ),
994 EXC_NUMFMT_STRING( 65, "$#,##0.00;-$#,##0.00" ),
995 EXC_NUMFMT_STRING( 66, "$#,##0.00;[RED]-$#,##0.00" ),
996 EXC_NUMFMT_ENDTABLE()
999 static const XclBuiltInFormat spBuiltInFormats_ENGLISH_AUS[] =
1001 EXC_NUMFMT_STRING( 14, "D/MM/YYYY" ),
1002 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1003 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1004 EXC_NUMFMT_STRING( 20, "h:mm" ),
1005 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
1006 EXC_NUMFMT_STRING( 22, "D/MM/YYYY h:mm" ),
1007 EXC_NUMFMT_STRING( 63, "$#,##0;-$#,##0" ),
1008 EXC_NUMFMT_STRING( 64, "$#,##0;[RED]-$#,##0" ),
1009 EXC_NUMFMT_STRING( 65, "$#,##0.00;-$#,##0.00" ),
1010 EXC_NUMFMT_STRING( 66, "$#,##0.00;[RED]-$#,##0.00" ),
1011 EXC_NUMFMT_ENDTABLE()
1014 static const XclBuiltInFormat spBuiltInFormats_ENGLISH_SAFRICA[] =
1016 EXC_NUMFMT_STRING( 14, "YYYY/MM/DD" ),
1017 EXC_NUMFMT_OFFSET( 18, NF_TIME_HHMMAMPM ),
1018 EXC_NUMFMT_OFFSET( 19, NF_TIME_HHMMSSAMPM ),
1019 EXC_NUMFMT_STRING( 22, "YYYY/MM/DD hh:mm" ),
1020 EXC_NUMFMT_STRING( 63, "\\R #,##0;\\R -#,##0" ),
1021 EXC_NUMFMT_STRING( 64, "\\R #,##0;[RED]\\R -#,##0" ),
1022 EXC_NUMFMT_STRING( 65, "\\R #,##0.00;\\R -#,##0.00" ),
1023 EXC_NUMFMT_STRING( 66, "\\R #,##0.00;[RED]\\R -#,##0.00" ),
1024 EXC_NUMFMT_ENDTABLE()
1027 // FRENCH ---------------------------------------------------------------------
1029 /** Base table for French locales. */
1030 static const XclBuiltInFormat spBuiltInFormats_FRENCH[] =
1032 EXC_NUMFMT_STRING( 15, "DD-MMM-YY" ),
1033 EXC_NUMFMT_STRING( 16, "DD-MMM" ),
1034 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1035 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1036 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1037 EXC_NUMFMT_ENDTABLE()
1040 static const XclBuiltInFormat spBuiltInFormats_FRENCH_FRANCE[] =
1042 EXC_NUMFMT_STRING( 22, "DD/MM/YYYY hh:mm" ),
1043 EXC_NUMFMT_STRING( 37, "#,##0\\ _" UTF8_EURO ";-#,##0\\ _" UTF8_EURO ),
1044 EXC_NUMFMT_STRING( 38, "#,##0\\ _" UTF8_EURO ";[RED]-#,##0\\ _" UTF8_EURO ),
1045 EXC_NUMFMT_STRING( 39, "#,##0.00\\ _" UTF8_EURO ";-#,##0.00\\ _" UTF8_EURO ),
1046 EXC_NUMFMT_STRING( 40, "#,##0.00\\ _" UTF8_EURO ";[RED]-#,##0.00\\ _" UTF8_EURO ),
1047 EXC_NUMFMT_STRING( 63, "#,##0\\ " UTF8_EURO ";-#,##0\\ " UTF8_EURO ),
1048 EXC_NUMFMT_STRING( 64, "#,##0\\ " UTF8_EURO ";[RED]-#,##0\\ " UTF8_EURO ),
1049 EXC_NUMFMT_STRING( 65, "#,##0.00\\ " UTF8_EURO ";-#,##0.00\\ " UTF8_EURO ),
1050 EXC_NUMFMT_STRING( 66, "#,##0.00\\ " UTF8_EURO ";[RED]-#,##0.00\\ " UTF8_EURO ),
1051 EXC_NUMFMT_ENDTABLE()
1054 static const XclBuiltInFormat spBuiltInFormats_FRENCH_CANADIAN[] =
1056 EXC_NUMFMT_STRING( 22, "YYYY-MM-DD hh:mm" ),
1057 EXC_NUMFMT_STRING( 37, "#,##0\\ _$_-;#,##0\\ _$-" ),
1058 EXC_NUMFMT_STRING( 38, "#,##0\\ _$_-;[RED]#,##0\\ _$-" ),
1059 EXC_NUMFMT_STRING( 39, "#,##0.00\\ _$_-;#,##0.00\\ _$-" ),
1060 EXC_NUMFMT_STRING( 40, "#,##0.00\\ _$_-;[RED]#,##0.00\\ _$-" ),
1061 EXC_NUMFMT_STRING( 63, "#,##0\\ $_-;#,##0\\ $-" ),
1062 EXC_NUMFMT_STRING( 64, "#,##0\\ $_-;[RED]#,##0\\ $-" ),
1063 EXC_NUMFMT_STRING( 65, "#,##0.00\\ $_-;#,##0.00\\ $-" ),
1064 EXC_NUMFMT_STRING( 66, "#,##0.00\\ $_-;[RED]#,##0.00\\ $-" ),
1065 EXC_NUMFMT_ENDTABLE()
1068 static const XclBuiltInFormat spBuiltInFormats_FRENCH_SWISS[] =
1070 EXC_NUMFMT_STRING( 15, "DD.MMM.YY" ),
1071 EXC_NUMFMT_STRING( 16, "DD.MMM" ),
1072 EXC_NUMFMT_STRING( 17, "MMM.YY" ),
1073 EXC_NUMFMT_STRING( 22, "DD.MM.YYYY hh:mm" ),
1074 EXC_NUMFMT_STRING( 63, "\"SFr. \"#,##0;\"SFr. \"-#,##0" ),
1075 EXC_NUMFMT_STRING( 64, "\"SFr. \"#,##0;[RED]\"SFr. \"-#,##0" ),
1076 EXC_NUMFMT_STRING( 65, "\"SFr. \"#,##0.00;\"SFr. \"-#,##0.00" ),
1077 EXC_NUMFMT_STRING( 66, "\"SFr. \"#,##0.00;[RED]\"SFr. \"-#,##0.00" ),
1078 EXC_NUMFMT_ENDTABLE()
1081 static const XclBuiltInFormat spBuiltInFormats_FRENCH_BELGIAN[] =
1083 EXC_NUMFMT_STRING( 14, "D/MM/YYYY" ),
1084 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1085 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1086 EXC_NUMFMT_STRING( 20, "h:mm" ),
1087 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
1088 EXC_NUMFMT_STRING( 22, "D/MM/YYYY h:mm" ),
1089 EXC_NUMFMT_ENDTABLE()
1092 // GERMAN ---------------------------------------------------------------------
1094 /** Base table for German locales. */
1095 static const XclBuiltInFormat spBuiltInFormats_GERMAN[] =
1097 EXC_NUMFMT_STRING( 15, "DD. MMM YY" ),
1098 EXC_NUMFMT_STRING( 16, "DD. MMM" ),
1099 EXC_NUMFMT_STRING( 17, "MMM YY" ),
1100 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1101 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1102 EXC_NUMFMT_STRING( 22, "DD.MM.YYYY hh:mm" ),
1103 EXC_NUMFMT_ENDTABLE()
1106 static const XclBuiltInFormat spBuiltInFormats_GERMAN_GERMANY[] =
1108 EXC_NUMFMT_STRING( 37, "#,##0 _" UTF8_EURO ";-#,##0 _" UTF8_EURO ),
1109 EXC_NUMFMT_STRING( 38, "#,##0 _" UTF8_EURO ";[RED]-#,##0 _" UTF8_EURO ),
1110 EXC_NUMFMT_STRING( 39, "#,##0.00 _" UTF8_EURO ";-#,##0.00 _" UTF8_EURO ),
1111 EXC_NUMFMT_STRING( 40, "#,##0.00 _" UTF8_EURO ";[RED]-#,##0.00 _" UTF8_EURO ),
1112 EXC_NUMFMT_STRING( 63, "#,##0 " UTF8_EURO ";-#,##0 " UTF8_EURO ),
1113 EXC_NUMFMT_STRING( 64, "#,##0 " UTF8_EURO ";[RED]-#,##0 " UTF8_EURO ),
1114 EXC_NUMFMT_STRING( 65, "#,##0.00 " UTF8_EURO ";-#,##0.00 " UTF8_EURO ),
1115 EXC_NUMFMT_STRING( 66, "#,##0.00 " UTF8_EURO ";[RED]-#,##0.00 " UTF8_EURO ),
1116 EXC_NUMFMT_ENDTABLE()
1119 static const XclBuiltInFormat spBuiltInFormats_GERMAN_AUSTRIAN[] =
1121 EXC_NUMFMT_STRING( 15, "DD.MMM.YY" ),
1122 EXC_NUMFMT_STRING( 16, "DD.MMM" ),
1123 EXC_NUMFMT_STRING( 17, "MMM.YY" ),
1124 EXC_NUMFMT_STRING( 63, UTF8_EURO " #,##0;-" UTF8_EURO " #,##0" ),
1125 EXC_NUMFMT_STRING( 64, UTF8_EURO " #,##0;[RED]-" UTF8_EURO " #,##0" ),
1126 EXC_NUMFMT_STRING( 65, UTF8_EURO " #,##0.00;-" UTF8_EURO " #,##0.00" ),
1127 EXC_NUMFMT_STRING( 66, UTF8_EURO " #,##0.00;[RED]-" UTF8_EURO " #,##0.00" ),
1128 EXC_NUMFMT_ENDTABLE()
1131 static const XclBuiltInFormat spBuiltInFormats_GERMAN_SWISS[] =
1133 EXC_NUMFMT_STRING( 63, "\"SFr. \"#,##0;\"SFr. \"-#,##0" ),
1134 EXC_NUMFMT_STRING( 64, "\"SFr. \"#,##0;[RED]\"SFr. \"-#,##0" ),
1135 EXC_NUMFMT_STRING( 65, "\"SFr. \"#,##0.00;\"SFr. \"-#,##0.00" ),
1136 EXC_NUMFMT_STRING( 66, "\"SFr. \"#,##0.00;[RED]\"SFr. \"-#,##0.00" ),
1137 EXC_NUMFMT_ENDTABLE()
1140 static const XclBuiltInFormat spBuiltInFormats_GERMAN_LUXEMBOURG[] =
1142 EXC_NUMFMT_STRING( 15, "DD.MMM.YY" ),
1143 EXC_NUMFMT_STRING( 16, "DD.MMM" ),
1144 EXC_NUMFMT_STRING( 17, "MMM.YY" ),
1145 EXC_NUMFMT_STRING( 37, "#,##0 _" UTF8_EURO ";-#,##0 _" UTF8_EURO ),
1146 EXC_NUMFMT_STRING( 38, "#,##0 _" UTF8_EURO ";[RED]-#,##0 _" UTF8_EURO ),
1147 EXC_NUMFMT_STRING( 39, "#,##0.00 _" UTF8_EURO ";-#,##0.00 _" UTF8_EURO ),
1148 EXC_NUMFMT_STRING( 40, "#,##0.00 _" UTF8_EURO ";[RED]-#,##0.00 _" UTF8_EURO ),
1149 EXC_NUMFMT_STRING( 63, "#,##0 " UTF8_EURO ";-#,##0 " UTF8_EURO ),
1150 EXC_NUMFMT_STRING( 64, "#,##0 " UTF8_EURO ";[RED]-#,##0 " UTF8_EURO ),
1151 EXC_NUMFMT_STRING( 65, "#,##0.00 " UTF8_EURO ";-#,##0.00 " UTF8_EURO ),
1152 EXC_NUMFMT_STRING( 66, "#,##0.00 " UTF8_EURO ";[RED]-#,##0.00 " UTF8_EURO ),
1153 EXC_NUMFMT_ENDTABLE()
1156 static const XclBuiltInFormat spBuiltInFormats_GERMAN_LIECHTENSTEIN[] =
1158 EXC_NUMFMT_STRING( 63, "\"CHF \"#,##0;\"CHF \"-#,##0" ),
1159 EXC_NUMFMT_STRING( 64, "\"CHF \"#,##0;[RED]\"CHF \"-#,##0" ),
1160 EXC_NUMFMT_STRING( 65, "\"CHF \"#,##0.00;\"CHF \"-#,##0.00" ),
1161 EXC_NUMFMT_STRING( 66, "\"CHF \"#,##0.00;[RED]\"CHF \"-#,##0.00" ),
1162 EXC_NUMFMT_ENDTABLE()
1165 // ITALIAN --------------------------------------------------------------------
1167 static const XclBuiltInFormat spBuiltInFormats_ITALIAN_ITALY[] =
1169 EXC_NUMFMT_STRING( 15, "DD-MMM-YY" ),
1170 EXC_NUMFMT_STRING( 16, "DD-MMM" ),
1171 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1172 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1173 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1174 EXC_NUMFMT_STRING( 20, "h:mm" ),
1175 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
1176 EXC_NUMFMT_STRING( 22, "DD/MM/YYYY h:mm" ),
1177 EXC_NUMFMT_STRING( 63, UTF8_EURO " #,##0;-" UTF8_EURO " #,##0" ),
1178 EXC_NUMFMT_STRING( 64, UTF8_EURO " #,##0;[RED]-" UTF8_EURO " #,##0" ),
1179 EXC_NUMFMT_STRING( 65, UTF8_EURO " #,##0.00;-" UTF8_EURO " #,##0.00" ),
1180 EXC_NUMFMT_STRING( 66, UTF8_EURO " #,##0.00;[RED]-" UTF8_EURO " #,##0.00" ),
1181 EXC_NUMFMT_ENDTABLE()
1184 static const XclBuiltInFormat spBuiltInFormats_ITALIAN_SWISS[] =
1186 EXC_NUMFMT_STRING( 15, "DD.MMM.YY" ),
1187 EXC_NUMFMT_STRING( 16, "DD.MMM" ),
1188 EXC_NUMFMT_STRING( 17, "MMM.YY" ),
1189 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1190 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1191 EXC_NUMFMT_STRING( 22, "DD.MM.YYYY hh:mm" ),
1192 EXC_NUMFMT_STRING( 63, "\"SFr. \"#,##0;\"SFr. \"-#,##0" ),
1193 EXC_NUMFMT_STRING( 64, "\"SFr. \"#,##0;[RED]\"SFr. \"-#,##0" ),
1194 EXC_NUMFMT_STRING( 65, "\"SFr. \"#,##0.00;\"SFr. \"-#,##0.00" ),
1195 EXC_NUMFMT_STRING( 66, "\"SFr. \"#,##0.00;[RED]\"SFr. \"-#,##0.00" ),
1196 EXC_NUMFMT_ENDTABLE()
1199 // SWEDISH --------------------------------------------------------------------
1201 static const XclBuiltInFormat spBuiltInFormats_SWEDISH_SWEDEN[] =
1203 EXC_NUMFMT_STRING( 15, "DD-MMM-YY" ),
1204 EXC_NUMFMT_STRING( 16, "DD-MMM" ),
1205 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1206 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1207 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1208 EXC_NUMFMT_STRING( 22, "YYYY-MM-DD hh:mm" ),
1209 EXC_NUMFMT_STRING( 37, "#,##0 _k_r;-#,##0 _k_r" ),
1210 EXC_NUMFMT_STRING( 38, "#,##0 _k_r;[RED]-#,##0 _k_r" ),
1211 EXC_NUMFMT_STRING( 39, "#,##0.00 _k_r;-#,##0.00 _k_r" ),
1212 EXC_NUMFMT_STRING( 40, "#,##0.00 _k_r;[RED]-#,##0.00 _k_r" ),
1213 EXC_NUMFMT_STRING( 63, "#,##0 \"kr\";-#,##0 \"kr\"" ),
1214 EXC_NUMFMT_STRING( 64, "#,##0 \"kr\";[RED]-#,##0 \"kr\"" ),
1215 EXC_NUMFMT_STRING( 65, "#,##0.00 \"kr\";-#,##0.00 \"kr\"" ),
1216 EXC_NUMFMT_STRING( 66, "#,##0.00 \"kr\";[RED]-#,##0.00 \"kr\"" ),
1217 EXC_NUMFMT_ENDTABLE()
1220 static const XclBuiltInFormat spBuiltInFormats_SWEDISH_FINLAND[] =
1222 EXC_NUMFMT_STRING( 9, "0 %" ),
1223 EXC_NUMFMT_STRING( 10, "0.00 %" ),
1224 EXC_NUMFMT_STRING( 15, "DD.MMM.YY" ),
1225 EXC_NUMFMT_STRING( 16, "DD.MMM" ),
1226 EXC_NUMFMT_STRING( 17, "MMM.YY" ),
1227 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1228 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1229 EXC_NUMFMT_STRING( 22, "D.M.YYYY hh:mm" ),
1230 EXC_NUMFMT_STRING( 37, "#,##0 _" UTF8_EURO ";-#,##0 _" UTF8_EURO ),
1231 EXC_NUMFMT_STRING( 38, "#,##0 _" UTF8_EURO ";[RED]-#,##0 _" UTF8_EURO ),
1232 EXC_NUMFMT_STRING( 39, "#,##0.00 _" UTF8_EURO ";-#,##0.00 _" UTF8_EURO ),
1233 EXC_NUMFMT_STRING( 40, "#,##0.00 _" UTF8_EURO ";[RED]-#,##0.00 _" UTF8_EURO ),
1234 EXC_NUMFMT_STRING( 63, "#,##0 " UTF8_EURO ";-#,##0 " UTF8_EURO ),
1235 EXC_NUMFMT_STRING( 64, "#,##0 " UTF8_EURO ";[RED]-#,##0 " UTF8_EURO ),
1236 EXC_NUMFMT_STRING( 65, "#,##0.00 " UTF8_EURO ";-#,##0.00 " UTF8_EURO ),
1237 EXC_NUMFMT_STRING( 66, "#,##0.00 " UTF8_EURO ";[RED]-#,##0.00 " UTF8_EURO ),
1238 EXC_NUMFMT_ENDTABLE()
1241 // ASIAN ----------------------------------------------------------------------
1243 /** Base table for Asian locales. */
1244 static const XclBuiltInFormat spBuiltInFormats_ASIAN[] =
1246 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1247 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1248 EXC_NUMFMT_STRING( 20, "h:mm" ),
1249 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
1250 EXC_NUMFMT_STRING( 23, "$#,##0_);($#,##0)" ),
1251 EXC_NUMFMT_STRING( 24, "$#,##0_);[RED]($#,##0)" ),
1252 EXC_NUMFMT_STRING( 25, "$#,##0.00_);($#,##0.00)" ),
1253 EXC_NUMFMT_STRING( 26, "$#,##0.00_);[RED]($#,##0.00)" ),
1254 EXC_NUMFMT_REUSE( 29, 28 ),
1255 EXC_NUMFMT_REUSE( 36, 27 ),
1256 EXC_NUMFMT_REUSE( 50, 27 ),
1257 EXC_NUMFMT_REUSE( 51, 28 ),
1258 EXC_NUMFMT_REUSE( 52, 34 ),
1259 EXC_NUMFMT_REUSE( 53, 35 ),
1260 EXC_NUMFMT_REUSE( 54, 28 ),
1261 EXC_NUMFMT_REUSE( 55, 34 ),
1262 EXC_NUMFMT_REUSE( 56, 35 ),
1263 EXC_NUMFMT_REUSE( 57, 27 ),
1264 EXC_NUMFMT_REUSE( 58, 28 ),
1265 EXC_NUMFMT_ENDTABLE()
1268 static const XclBuiltInFormat spBuiltInFormats_JAPANESE[] =
1270 EXC_NUMFMT_STRING( 14, "YYYY/M/D" ),
1271 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1272 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1273 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1274 EXC_NUMFMT_STRING( 22, "YYYY/M/D h:mm" ),
1275 EXC_NUMFMT_STRING( 27, "[$-0411]GE.M.D" ),
1276 EXC_NUMFMT_STRING( 28, "[$-0411]GGGE" UTF8_CJ_YEAR "M" UTF8_CJ_MON "D" UTF8_CJ_DAY ),
1277 EXC_NUMFMT_STRING( 30, "[$-0411]M/D/YY" ),
1278 EXC_NUMFMT_STRING( 31, "[$-0411]YYYY" UTF8_CJ_YEAR "M" UTF8_CJ_MON "D" UTF8_CJ_DAY ),
1279 EXC_NUMFMT_STRING( 32, "[$-0411]h" UTF8_CJ_HOUR "mm" UTF8_CJ_MIN ),
1280 EXC_NUMFMT_STRING( 33, "[$-0411]h" UTF8_CJ_HOUR "mm" UTF8_CJ_MIN "ss" UTF8_CJ_SEC ),
1281 EXC_NUMFMT_STRING( 34, "[$-0411]YYYY" UTF8_CJ_YEAR "M" UTF8_CJ_MON ),
1282 EXC_NUMFMT_STRING( 35, "[$-0411]M" UTF8_CJ_MON "D" UTF8_CJ_DAY ),
1283 EXC_NUMFMT_STRING( 63, UTF8_YEN_JP "#,##0;-" UTF8_YEN_JP "#,##0" ),
1284 EXC_NUMFMT_STRING( 64, UTF8_YEN_JP "#,##0;[RED]-" UTF8_YEN_JP "#,##0" ),
1285 EXC_NUMFMT_STRING( 65, UTF8_YEN_JP "#,##0.00;-" UTF8_YEN_JP "#,##0.00" ),
1286 EXC_NUMFMT_STRING( 66, UTF8_YEN_JP "#,##0.00;[RED]-" UTF8_YEN_JP "#,##0.00" ),
1287 EXC_NUMFMT_ENDTABLE()
1290 static const XclBuiltInFormat spBuiltInFormats_KOREAN[] =
1292 EXC_NUMFMT_STRING( 14, "YYYY-MM-DD" ),
1293 EXC_NUMFMT_STRING( 15, "DD-MMM-YY" ),
1294 EXC_NUMFMT_STRING( 16, "DD-MMM" ),
1295 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1296 EXC_NUMFMT_STRING( 22, "YYYY-MM-DD h:mm" ),
1297 EXC_NUMFMT_STRING( 27, "[$-0412]YYYY" UTF8_CJ_YEAR " MM" UTF8_CJ_MON " DD" UTF8_CJ_DAY ),
1298 EXC_NUMFMT_STRING( 28, "[$-0412]MM-DD" ),
1299 EXC_NUMFMT_STRING( 30, "[$-0412]MM-DD-YY" ),
1300 EXC_NUMFMT_STRING( 31, "[$-0412]YYYY" UTF8_KO_YEAR " MM" UTF8_KO_MON " DD" UTF8_KO_DAY ),
1301 EXC_NUMFMT_STRING( 32, "[$-0412]h" UTF8_KO_HOUR " mm" UTF8_KO_MIN ),
1302 EXC_NUMFMT_STRING( 33, "[$-0412]h" UTF8_KO_HOUR " mm" UTF8_KO_MIN " ss" UTF8_KO_SEC ),
1303 EXC_NUMFMT_STRING( 34, "[$-0412]YYYY\"/\"MM\"/\"DD" ),
1304 EXC_NUMFMT_STRING( 35, "[$-0412]YYYY-MM-DD" ),
1305 EXC_NUMFMT_STRING( 63, UTF8_WON "#,##0;-" UTF8_WON "#,##0" ),
1306 EXC_NUMFMT_STRING( 64, UTF8_WON "#,##0;[RED]-" UTF8_WON "#,##0" ),
1307 EXC_NUMFMT_STRING( 65, UTF8_WON "#,##0.00;-" UTF8_WON "#,##0.00" ),
1308 EXC_NUMFMT_STRING( 66, UTF8_WON "#,##0.00;[RED]-" UTF8_WON "#,##0.00" ),
1309 EXC_NUMFMT_ENDTABLE()
1312 static const XclBuiltInFormat spBuiltInFormats_CHINESE_SIMPLIFIED[] =
1314 EXC_NUMFMT_STRING( 14, "YYYY-M-D" ),
1315 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1316 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1317 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1318 EXC_NUMFMT_STRING( 22, "YYYY-M-D h:mm" ),
1319 EXC_NUMFMT_STRING( 27, "[$-0804]YYYY" UTF8_CJ_YEAR "M" UTF8_CJ_MON ),
1320 EXC_NUMFMT_STRING( 28, "[$-0804]M" UTF8_CJ_MON "D" UTF8_CJ_DAY ),
1321 EXC_NUMFMT_STRING( 30, "[$-0804]M-D-YY" ),
1322 EXC_NUMFMT_STRING( 31, "[$-0804]YYYY" UTF8_CJ_YEAR "M" UTF8_CJ_MON "D" UTF8_CJ_DAY ),
1323 EXC_NUMFMT_STRING( 32, "[$-0804]h" UTF8_CS_HOUR "mm" UTF8_CJ_MIN ),
1324 EXC_NUMFMT_STRING( 33, "[$-0804]h" UTF8_CS_HOUR "mm" UTF8_CJ_MIN "ss" UTF8_CJ_SEC ),
1325 EXC_NUMFMT_STRING( 34, "[$-0804]AM/PMh" UTF8_CS_HOUR "mm" UTF8_CJ_MIN ),
1326 EXC_NUMFMT_STRING( 35, "[$-0804]AM/PMh" UTF8_CS_HOUR "mm" UTF8_CJ_MIN "ss" UTF8_CJ_SEC ),
1327 EXC_NUMFMT_REUSE( 52, 27 ),
1328 EXC_NUMFMT_REUSE( 53, 28 ),
1329 EXC_NUMFMT_STRING( 63, UTF8_YEN_CS "#,##0;-" UTF8_YEN_CS "#,##0" ),
1330 EXC_NUMFMT_STRING( 64, UTF8_YEN_CS "#,##0;[RED]-" UTF8_YEN_CS "#,##0" ),
1331 EXC_NUMFMT_STRING( 65, UTF8_YEN_CS "#,##0.00;-" UTF8_YEN_CS "#,##0.00" ),
1332 EXC_NUMFMT_STRING( 66, UTF8_YEN_CS "#,##0.00;[RED]-" UTF8_YEN_CS "#,##0.00" ),
1333 EXC_NUMFMT_ENDTABLE()
1336 static const XclBuiltInFormat spBuiltInFormats_CHINESE_TRADITIONAL[] =
1338 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1339 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1340 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1341 EXC_NUMFMT_STRING( 18, "hh:mm AM/PM" ),
1342 EXC_NUMFMT_STRING( 19, "hh:mm:ss AM/PM" ),
1343 EXC_NUMFMT_OFFSET( 20, NF_TIME_HHMM ),
1344 EXC_NUMFMT_OFFSET( 21, NF_TIME_HHMMSS ),
1345 EXC_NUMFMT_STRING( 22, "YYYY/M/D hh:mm" ),
1346 EXC_NUMFMT_STRING( 23, "US$#,##0_);(US$#,##0)" ),
1347 EXC_NUMFMT_STRING( 24, "US$#,##0_);[RED](US$#,##0)" ),
1348 EXC_NUMFMT_STRING( 25, "US$#,##0.00_);(US$#,##0.00)" ),
1349 EXC_NUMFMT_STRING( 26, "US$#,##0.00_);[RED](US$#,##0.00)" ),
1350 EXC_NUMFMT_STRING( 27, "[$-0404]E/M/D" ),
1351 EXC_NUMFMT_STRING( 28, "[$-0404]E" UTF8_CJ_YEAR "M" UTF8_CJ_MON "D" UTF8_CJ_DAY ),
1352 EXC_NUMFMT_STRING( 30, "[$-0404]M/D/YY" ),
1353 EXC_NUMFMT_STRING( 31, "[$-0404]YYYY" UTF8_CJ_YEAR "M" UTF8_CJ_MON "D" UTF8_CJ_DAY ),
1354 EXC_NUMFMT_STRING( 32, "[$-0404]hh" UTF8_CJ_HOUR "mm" UTF8_CJ_MIN ),
1355 EXC_NUMFMT_STRING( 33, "[$-0404]hh" UTF8_CJ_HOUR "mm" UTF8_CJ_MIN "ss" UTF8_CJ_SEC ),
1356 EXC_NUMFMT_STRING( 34, "[$-0404]AM/PMhh" UTF8_CJ_HOUR "mm" UTF8_CJ_MIN ),
1357 EXC_NUMFMT_STRING( 35, "[$-0404]AM/PMhh" UTF8_CJ_HOUR "mm" UTF8_CJ_MIN "ss" UTF8_CJ_SEC ),
1358 EXC_NUMFMT_STRING( 63, "$#,##0;-$#,##0" ),
1359 EXC_NUMFMT_STRING( 64, "$#,##0;[RED]-$#,##0" ),
1360 EXC_NUMFMT_STRING( 65, "$#,##0.00;-$#,##0.00" ),
1361 EXC_NUMFMT_STRING( 66, "$#,##0.00;[RED]-$#,##0.00" ),
1362 EXC_NUMFMT_ENDTABLE()
1365 // OTHER ----------------------------------------------------------------------
1367 static const XclBuiltInFormat spBuiltInFormats_HEBREW[] =
1369 EXC_NUMFMT_STRING( 15, "DD-MMMM-YY" ),
1370 EXC_NUMFMT_STRING( 16, "DD-MMMM" ),
1371 EXC_NUMFMT_STRING( 17, "MMMM-YY" ),
1372 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1373 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1374 EXC_NUMFMT_STRING( 63, UTF8_SHEQEL " #,##0;" UTF8_SHEQEL " -#,##0" ),
1375 EXC_NUMFMT_STRING( 64, UTF8_SHEQEL " #,##0;[RED]" UTF8_SHEQEL " -#,##0" ),
1376 EXC_NUMFMT_STRING( 65, UTF8_SHEQEL " #,##0.00;" UTF8_SHEQEL " -#,##0.00" ),
1377 EXC_NUMFMT_STRING( 66, UTF8_SHEQEL " #,##0.00;[RED]" UTF8_SHEQEL " -#,##0.00" ),
1378 EXC_NUMFMT_ENDTABLE()
1381 static const XclBuiltInFormat spBuiltInFormats_THAI[] =
1383 EXC_NUMFMT_STRING( 14, "D/M/YYYY" ),
1384 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1385 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1386 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1387 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1388 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1389 EXC_NUMFMT_STRING( 22, "D/M/YYYY h:mm" ),
1390 EXC_NUMFMT_STRING( 59, "t0" ),
1391 EXC_NUMFMT_STRING( 60, "t0.00" ),
1392 EXC_NUMFMT_STRING( 61, "t#,##0" ),
1393 EXC_NUMFMT_STRING( 62, "t#,##0.00" ),
1394 EXC_NUMFMT_STRING( 63, "t" UTF8_BAHT "#,##0_);t(" UTF8_BAHT "#,##0)" ),
1395 EXC_NUMFMT_STRING( 64, "t" UTF8_BAHT "#,##0_);[RED]t(" UTF8_BAHT "#,##0)" ),
1396 EXC_NUMFMT_STRING( 65, "t" UTF8_BAHT "#,##0.00_);t(" UTF8_BAHT "#,##0.00)" ),
1397 EXC_NUMFMT_STRING( 66, "t" UTF8_BAHT "#,##0.00_);[RED]t(" UTF8_BAHT "#,##0.00)" ),
1398 EXC_NUMFMT_STRING( 67, "t0%" ),
1399 EXC_NUMFMT_STRING( 68, "t0.00%" ),
1400 EXC_NUMFMT_STRING( 69, "t# ?/?" ),
1401 EXC_NUMFMT_STRING( 70, "t# ?\?/?\?" ),
1402 EXC_NUMFMT_STRING( 71, "tD/M/EE" ),
1403 EXC_NUMFMT_STRING( 72, "tD-MMM-E" ),
1404 EXC_NUMFMT_STRING( 73, "tD-MMM" ),
1405 EXC_NUMFMT_STRING( 74, "tMMM-E" ),
1406 EXC_NUMFMT_STRING( 75, "th:mm" ),
1407 EXC_NUMFMT_STRING( 76, "th:mm:ss" ),
1408 EXC_NUMFMT_STRING( 77, "tD/M/EE h:mm" ),
1409 EXC_NUMFMT_STRING( 78, "tmm:ss" ),
1410 EXC_NUMFMT_STRING( 79, "t[h]:mm:ss" ),
1411 EXC_NUMFMT_STRING( 80, "tmm:ss.0" ),
1412 EXC_NUMFMT_STRING( 81, "D/M/E" ),
1413 EXC_NUMFMT_ENDTABLE()
1416 // ----------------------------------------------------------------------------
1418 #undef EXC_NUMFMT_ENDTABLE
1419 #undef EXC_NUMFMT_REUSE
1420 #undef EXC_NUMFMT_OFFSET
1421 #undef EXC_NUMFMT_STRING
1423 // ----------------------------------------------------------------------------
1425 /** Specifies a number format table for a specific langauge. */
1426 struct XclBuiltInFormatTable
1428 LanguageType meLanguage; /// The language of this table.
1429 LanguageType meParentLang; /// The language of the parent table.
1430 const XclBuiltInFormat* mpFormats; /// The number format table.
1433 static const XclBuiltInFormatTable spBuiltInFormatTables[] =
1434 { // language parent language format table
1435 { LANGUAGE_DONTKNOW, LANGUAGE_NONE, spBuiltInFormats_DONTKNOW },
1437 { LANGUAGE_ENGLISH, LANGUAGE_DONTKNOW, spBuiltInFormats_ENGLISH },
1438 { LANGUAGE_ENGLISH_UK, LANGUAGE_ENGLISH, spBuiltInFormats_ENGLISH_UK },
1439 { LANGUAGE_ENGLISH_EIRE, LANGUAGE_ENGLISH, spBuiltInFormats_ENGLISH_EIRE },
1440 { LANGUAGE_ENGLISH_US, LANGUAGE_ENGLISH, spBuiltInFormats_ENGLISH_US },
1441 { LANGUAGE_ENGLISH_CAN, LANGUAGE_ENGLISH, spBuiltInFormats_ENGLISH_CAN },
1442 { LANGUAGE_ENGLISH_AUS, LANGUAGE_ENGLISH, spBuiltInFormats_ENGLISH_AUS },
1443 { LANGUAGE_ENGLISH_SAFRICA, LANGUAGE_ENGLISH, spBuiltInFormats_ENGLISH_SAFRICA },
1444 { LANGUAGE_ENGLISH_NZ, LANGUAGE_ENGLISH_AUS, 0 },
1446 { PRV_LANGUAGE_FRENCH_PRIM, LANGUAGE_DONTKNOW, spBuiltInFormats_FRENCH },
1447 { LANGUAGE_FRENCH, PRV_LANGUAGE_FRENCH_PRIM, spBuiltInFormats_FRENCH_FRANCE },
1448 { LANGUAGE_FRENCH_CANADIAN, PRV_LANGUAGE_FRENCH_PRIM, spBuiltInFormats_FRENCH_CANADIAN },
1449 { LANGUAGE_FRENCH_SWISS, PRV_LANGUAGE_FRENCH_PRIM, spBuiltInFormats_FRENCH_SWISS },
1450 { LANGUAGE_FRENCH_BELGIAN, LANGUAGE_FRENCH, spBuiltInFormats_FRENCH_BELGIAN },
1451 { LANGUAGE_FRENCH_LUXEMBOURG, LANGUAGE_FRENCH, 0 },
1452 { LANGUAGE_FRENCH_MONACO, LANGUAGE_FRENCH, 0 },
1454 { PRV_LANGUAGE_GERMAN_PRIM, LANGUAGE_DONTKNOW, spBuiltInFormats_GERMAN },
1455 { LANGUAGE_GERMAN, PRV_LANGUAGE_GERMAN_PRIM, spBuiltInFormats_GERMAN_GERMANY },
1456 { LANGUAGE_GERMAN_AUSTRIAN, PRV_LANGUAGE_GERMAN_PRIM, spBuiltInFormats_GERMAN_AUSTRIAN },
1457 { LANGUAGE_GERMAN_SWISS, PRV_LANGUAGE_GERMAN_PRIM, spBuiltInFormats_GERMAN_SWISS },
1458 { LANGUAGE_GERMAN_LUXEMBOURG, PRV_LANGUAGE_GERMAN_PRIM, spBuiltInFormats_GERMAN_LUXEMBOURG },
1459 { LANGUAGE_GERMAN_LIECHTENSTEIN, PRV_LANGUAGE_GERMAN_PRIM, spBuiltInFormats_GERMAN_LIECHTENSTEIN },
1461 { LANGUAGE_ITALIAN, LANGUAGE_DONTKNOW, spBuiltInFormats_ITALIAN_ITALY },
1462 { LANGUAGE_ITALIAN_SWISS, LANGUAGE_DONTKNOW, spBuiltInFormats_ITALIAN_SWISS },
1464 { LANGUAGE_SWEDISH, LANGUAGE_DONTKNOW, spBuiltInFormats_SWEDISH_SWEDEN },
1465 { LANGUAGE_SWEDISH_FINLAND, LANGUAGE_DONTKNOW, spBuiltInFormats_SWEDISH_FINLAND },
1467 { PRV_LANGUAGE_ASIAN_PRIM, LANGUAGE_DONTKNOW, spBuiltInFormats_ASIAN },
1468 { LANGUAGE_JAPANESE, PRV_LANGUAGE_ASIAN_PRIM, spBuiltInFormats_JAPANESE },
1469 { LANGUAGE_KOREAN, PRV_LANGUAGE_ASIAN_PRIM, spBuiltInFormats_KOREAN },
1470 { LANGUAGE_CHINESE_SIMPLIFIED, PRV_LANGUAGE_ASIAN_PRIM, spBuiltInFormats_CHINESE_SIMPLIFIED },
1471 { LANGUAGE_CHINESE_TRADITIONAL, PRV_LANGUAGE_ASIAN_PRIM, spBuiltInFormats_CHINESE_TRADITIONAL },
1473 { LANGUAGE_HEBREW, LANGUAGE_DONTKNOW, spBuiltInFormats_HEBREW },
1474 { LANGUAGE_THAI, LANGUAGE_DONTKNOW, spBuiltInFormats_THAI }
1477 // ----------------------------------------------------------------------------
1479 } // namespace
1481 // ============================================================================
1483 XclNumFmtBuffer::XclNumFmtBuffer( const XclRoot& rRoot ) :
1484 meSysLang( rRoot.GetSysLanguage() ),
1485 mnStdScNumFmt( rRoot.GetFormatter().GetStandardFormat( ScGlobal::eLnge ) )
1487 // *** insert default formats (BIFF5+ only)***
1489 if( rRoot.GetBiff() >= EXC_BIFF5 )
1490 InsertBuiltinFormats();
1493 void XclNumFmtBuffer::InitializeImport()
1495 maFmtMap.clear();
1498 //UNUSED2008-05 const XclNumFmt* XclNumFmtBuffer::GetFormat( sal_uInt16 nXclNumFmt ) const
1499 //UNUSED2008-05 {
1500 //UNUSED2008-05 XclNumFmtMap::const_iterator aIt = maFmtMap.find( nXclNumFmt );
1501 //UNUSED2008-05 return (aIt != maFmtMap.end()) ? &aIt->second : 0;
1502 //UNUSED2008-05 }
1504 void XclNumFmtBuffer::InsertFormat( sal_uInt16 nXclNumFmt, const String& rFormat )
1506 XclNumFmt& rNumFmt = maFmtMap[ nXclNumFmt ];
1507 rNumFmt.maFormat = rFormat;
1508 // #i62053# rFormat may be an empty string, meOffset must be initialized
1509 rNumFmt.meOffset = NF_NUMBER_STANDARD;
1510 rNumFmt.meLanguage = LANGUAGE_SYSTEM;
1513 void XclNumFmtBuffer::InsertBuiltinFormats()
1515 // build a map containing tables for all languages
1516 typedef ::std::map< LanguageType, const XclBuiltInFormatTable* > XclBuiltInMap;
1517 XclBuiltInMap aBuiltInMap;
1518 for( const XclBuiltInFormatTable* pTable = spBuiltInFormatTables;
1519 pTable != STATIC_TABLE_END( spBuiltInFormatTables ); ++pTable )
1520 aBuiltInMap[ pTable->meLanguage ] = pTable;
1522 // build a list of table pointers for the current language, with all parent tables
1523 typedef ::std::vector< const XclBuiltInFormatTable* > XclBuiltInVec;
1524 XclBuiltInVec aBuiltInVec;
1525 for( XclBuiltInMap::const_iterator aMIt = aBuiltInMap.find( meSysLang ), aMEnd = aBuiltInMap.end();
1526 aMIt != aMEnd; aMIt = aBuiltInMap.find( aMIt->second->meParentLang ) )
1527 aBuiltInVec.push_back( aMIt->second );
1528 // language not supported
1529 if( aBuiltInVec.empty() )
1531 DBG_ERROR1( "XclNumFmtBuffer::InsertBuiltinFormats - language 0x%04hX not supported (#i29949#)", meSysLang );
1532 XclBuiltInMap::const_iterator aMIt = aBuiltInMap.find( LANGUAGE_DONTKNOW );
1533 DBG_ASSERT( aMIt != aBuiltInMap.end(), "XclNumFmtBuffer::InsertBuiltinFormats - default map not found" );
1534 if( aMIt != aBuiltInMap.end() )
1535 aBuiltInVec.push_back( aMIt->second );
1538 // insert the default formats in the format map, from root parent to system language
1539 typedef ::std::map< sal_uInt16, sal_uInt16 > XclReuseMap;
1540 XclReuseMap aReuseMap;
1541 for( XclBuiltInVec::reverse_iterator aVIt = aBuiltInVec.rbegin(), aVEnd = aBuiltInVec.rend(); aVIt != aVEnd; ++aVIt )
1543 // put LANGUAGE_SYSTEM for all entries in default table
1544 LanguageType eLang = ((*aVIt)->meLanguage == LANGUAGE_DONTKNOW) ? LANGUAGE_SYSTEM : meSysLang;
1545 for( const XclBuiltInFormat* pBuiltIn = (*aVIt)->mpFormats; pBuiltIn && (pBuiltIn->mnXclNumFmt != EXC_FORMAT_NOTFOUND); ++pBuiltIn )
1547 XclNumFmt& rNumFmt = maFmtMap[ pBuiltIn->mnXclNumFmt ];
1549 rNumFmt.meOffset = pBuiltIn->meOffset;
1550 rNumFmt.meLanguage = eLang;
1552 if( pBuiltIn->mpFormat )
1553 rNumFmt.maFormat = String( pBuiltIn->mpFormat, RTL_TEXTENCODING_UTF8 );
1554 else
1555 rNumFmt.maFormat = EMPTY_STRING;
1557 if( pBuiltIn->meOffset == PRV_NF_INDEX_REUSE )
1558 aReuseMap[ pBuiltIn->mnXclNumFmt ] = pBuiltIn->mnXclReuseFmt;
1559 else
1560 aReuseMap.erase( pBuiltIn->mnXclNumFmt );
1564 // copy reused number formats
1565 for( XclReuseMap::const_iterator aRIt = aReuseMap.begin(), aREnd = aReuseMap.end(); aRIt != aREnd; ++aRIt )
1566 maFmtMap[ aRIt->first ] = maFmtMap[ aRIt->second ];
1569 // Cell formatting data (XF) ==================================================
1571 XclCellProt::XclCellProt() :
1572 mbLocked( true ), // default in Excel and Calc
1573 mbHidden( false )
1577 bool operator==( const XclCellProt& rLeft, const XclCellProt& rRight )
1579 return (rLeft.mbLocked == rRight.mbLocked) && (rLeft.mbHidden == rRight.mbHidden);
1582 // ----------------------------------------------------------------------------
1584 XclCellAlign::XclCellAlign() :
1585 mnHorAlign( EXC_XF_HOR_GENERAL ),
1586 mnVerAlign( EXC_XF_VER_BOTTOM ),
1587 mnOrient( EXC_ORIENT_NONE ),
1588 mnTextDir( EXC_XF_TEXTDIR_CONTEXT ),
1589 mnRotation( EXC_ROT_NONE ),
1590 mnIndent( 0 ),
1591 mbLineBreak( false ),
1592 mbShrink( false )
1596 SvxCellHorJustify XclCellAlign::GetScHorAlign() const
1598 SvxCellHorJustify eHorJust = SVX_HOR_JUSTIFY_STANDARD;
1599 switch( mnHorAlign )
1601 case EXC_XF_HOR_GENERAL: eHorJust = SVX_HOR_JUSTIFY_STANDARD; break;
1602 case EXC_XF_HOR_LEFT: eHorJust = SVX_HOR_JUSTIFY_LEFT; break;
1603 case EXC_XF_HOR_CENTER_AS:
1604 case EXC_XF_HOR_CENTER: eHorJust = SVX_HOR_JUSTIFY_CENTER; break;
1605 case EXC_XF_HOR_RIGHT: eHorJust = SVX_HOR_JUSTIFY_RIGHT; break;
1606 case EXC_XF_HOR_FILL: eHorJust = SVX_HOR_JUSTIFY_REPEAT; break;
1607 case EXC_XF_HOR_JUSTIFY:
1608 case EXC_XF_HOR_DISTRIB: eHorJust = SVX_HOR_JUSTIFY_BLOCK; break;
1609 default: DBG_ERRORFILE( "XclCellAlign::GetScHorAlign - unknown horizontal alignment" );
1611 return eHorJust;
1614 SvxCellVerJustify XclCellAlign::GetScVerAlign() const
1616 SvxCellVerJustify eVerJust = SVX_VER_JUSTIFY_STANDARD;
1617 switch( mnVerAlign )
1619 case EXC_XF_VER_TOP: eVerJust = SVX_VER_JUSTIFY_TOP; break;
1620 case EXC_XF_VER_CENTER: eVerJust = SVX_VER_JUSTIFY_CENTER; break;
1621 case EXC_XF_VER_BOTTOM: eVerJust = SVX_VER_JUSTIFY_STANDARD; break;
1622 case EXC_XF_VER_JUSTIFY:
1623 case EXC_XF_VER_DISTRIB: eVerJust = SVX_VER_JUSTIFY_TOP; break;
1624 default: DBG_ERRORFILE( "XclCellAlign::GetScVerAlign - unknown vertical alignment" );
1626 return eVerJust;
1629 SvxFrameDirection XclCellAlign::GetScFrameDir() const
1631 SvxFrameDirection eFrameDir = FRMDIR_ENVIRONMENT;
1632 switch( mnTextDir )
1634 case EXC_XF_TEXTDIR_CONTEXT: eFrameDir = FRMDIR_ENVIRONMENT; break;
1635 case EXC_XF_TEXTDIR_LTR: eFrameDir = FRMDIR_HORI_LEFT_TOP; break;
1636 case EXC_XF_TEXTDIR_RTL: eFrameDir = FRMDIR_HORI_RIGHT_TOP; break;
1637 default: DBG_ERRORFILE( "XclCellAlign::GetScFrameDir - unknown CTL text direction" );
1639 return eFrameDir;
1642 void XclCellAlign::SetScHorAlign( SvxCellHorJustify eHorJust )
1644 switch( eHorJust )
1646 case SVX_HOR_JUSTIFY_STANDARD: mnHorAlign = EXC_XF_HOR_GENERAL; break;
1647 case SVX_HOR_JUSTIFY_LEFT: mnHorAlign = EXC_XF_HOR_LEFT; break;
1648 case SVX_HOR_JUSTIFY_CENTER: mnHorAlign = EXC_XF_HOR_CENTER; break;
1649 case SVX_HOR_JUSTIFY_RIGHT: mnHorAlign = EXC_XF_HOR_RIGHT; break;
1650 case SVX_HOR_JUSTIFY_BLOCK: mnHorAlign = EXC_XF_HOR_JUSTIFY; break;
1651 case SVX_HOR_JUSTIFY_REPEAT: mnHorAlign = EXC_XF_HOR_FILL; break;
1652 default: mnHorAlign = EXC_XF_HOR_GENERAL;
1653 DBG_ERROR( "XclCellAlign::SetScHorAlign - unknown horizontal alignment" );
1657 void XclCellAlign::SetScVerAlign( SvxCellVerJustify eVerJust )
1659 switch( eVerJust )
1661 case SVX_VER_JUSTIFY_STANDARD: mnVerAlign = EXC_XF_VER_BOTTOM; break;
1662 case SVX_VER_JUSTIFY_TOP: mnVerAlign = EXC_XF_VER_TOP; break;
1663 case SVX_VER_JUSTIFY_CENTER: mnVerAlign = EXC_XF_VER_CENTER; break;
1664 case SVX_VER_JUSTIFY_BOTTOM: mnVerAlign = EXC_XF_VER_BOTTOM; break;
1665 default: mnVerAlign = EXC_XF_VER_BOTTOM;
1666 DBG_ERROR( "XclCellAlign::SetScVerAlign - unknown vertical alignment" );
1670 void XclCellAlign::SetScFrameDir( SvxFrameDirection eFrameDir )
1672 switch( eFrameDir )
1674 case FRMDIR_ENVIRONMENT: mnTextDir = EXC_XF_TEXTDIR_CONTEXT; break;
1675 case FRMDIR_HORI_LEFT_TOP: mnTextDir = EXC_XF_TEXTDIR_LTR; break;
1676 case FRMDIR_HORI_RIGHT_TOP: mnTextDir = EXC_XF_TEXTDIR_RTL; break;
1677 default: mnTextDir = EXC_XF_TEXTDIR_CONTEXT;
1678 DBG_ERRORFILE( "XclCellAlign::SetScFrameDir - unknown CTL text direction" );
1682 bool operator==( const XclCellAlign& rLeft, const XclCellAlign& rRight )
1684 return
1685 (rLeft.mnHorAlign == rRight.mnHorAlign) && (rLeft.mnVerAlign == rRight.mnVerAlign) &&
1686 (rLeft.mnTextDir == rRight.mnTextDir) && (rLeft.mnOrient == rRight.mnOrient) &&
1687 (rLeft.mnRotation == rRight.mnRotation) && (rLeft.mnIndent == rRight.mnIndent) &&
1688 (rLeft.mbLineBreak == rRight.mbLineBreak) && (rLeft.mbShrink == rRight.mbShrink);
1691 // ----------------------------------------------------------------------------
1693 XclCellBorder::XclCellBorder() :
1694 mnLeftColor( 0 ),
1695 mnRightColor( 0 ),
1696 mnTopColor( 0 ),
1697 mnBottomColor( 0 ),
1698 mnDiagColor( 0 ),
1699 mnLeftLine( EXC_LINE_NONE ),
1700 mnRightLine( EXC_LINE_NONE ),
1701 mnTopLine( EXC_LINE_NONE ),
1702 mnBottomLine( EXC_LINE_NONE ),
1703 mnDiagLine( EXC_LINE_NONE ),
1704 mbDiagTLtoBR( false ),
1705 mbDiagBLtoTR( false )
1709 bool operator==( const XclCellBorder& rLeft, const XclCellBorder& rRight )
1711 return
1712 (rLeft.mnLeftColor == rRight.mnLeftColor) && (rLeft.mnRightColor == rRight.mnRightColor) &&
1713 (rLeft.mnTopColor == rRight.mnTopColor) && (rLeft.mnBottomColor == rRight.mnBottomColor) &&
1714 (rLeft.mnLeftLine == rRight.mnLeftLine) && (rLeft.mnRightLine == rRight.mnRightLine) &&
1715 (rLeft.mnTopLine == rRight.mnTopLine) && (rLeft.mnBottomLine == rRight.mnBottomLine) &&
1716 (rLeft.mnDiagColor == rRight.mnDiagColor) && (rLeft.mnDiagLine == rRight.mnDiagLine) &&
1717 (rLeft.mbDiagTLtoBR == rRight.mbDiagTLtoBR) && (rLeft.mbDiagBLtoTR == rRight.mbDiagBLtoTR);
1720 // ----------------------------------------------------------------------------
1722 XclCellArea::XclCellArea() :
1723 mnForeColor( EXC_COLOR_WINDOWTEXT ),
1724 mnBackColor( EXC_COLOR_WINDOWBACK ),
1725 mnPattern( EXC_PATT_NONE )
1729 bool XclCellArea::IsTransparent() const
1731 return (mnPattern == EXC_PATT_NONE) && (mnBackColor == EXC_COLOR_WINDOWBACK);
1734 bool operator==( const XclCellArea& rLeft, const XclCellArea& rRight )
1736 return
1737 (rLeft.mnForeColor == rRight.mnForeColor) && (rLeft.mnBackColor == rRight.mnBackColor) &&
1738 (rLeft.mnPattern == rRight.mnPattern);
1741 // ----------------------------------------------------------------------------
1743 XclXFBase::XclXFBase( bool bCellXF ) :
1744 mnParent( bCellXF ? EXC_XF_DEFAULTSTYLE : EXC_XF_STYLEPARENT ),
1745 mbCellXF( bCellXF )
1747 SetAllUsedFlags( false );
1750 XclXFBase::~XclXFBase()
1754 void XclXFBase::SetAllUsedFlags( bool bUsed )
1756 mbProtUsed = mbFontUsed = mbFmtUsed = mbAlignUsed = mbBorderUsed = mbAreaUsed = bUsed;
1759 bool XclXFBase::HasUsedFlags() const
1761 return mbProtUsed || mbFontUsed || mbFmtUsed || mbAlignUsed || mbBorderUsed || mbAreaUsed;
1764 bool XclXFBase::Equals( const XclXFBase& rCmp ) const
1766 return
1767 (mbCellXF == rCmp.mbCellXF) && (mnParent == rCmp.mnParent) &&
1768 (mbProtUsed == rCmp.mbProtUsed) && (mbFontUsed == rCmp.mbFontUsed) &&
1769 (mbFmtUsed == rCmp.mbFmtUsed) && (mbAlignUsed == rCmp.mbAlignUsed) &&
1770 (mbBorderUsed == rCmp.mbBorderUsed) && (mbAreaUsed == rCmp.mbAreaUsed);
1773 // ============================================================================