1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/FontStrikeout.hpp>
24 #include <com/sun/star/awt/FontUnderline.hpp>
25 #include <com/sun/star/i18n/ScriptType.hpp>
26 #include <vcl/svapp.hxx>
27 #include <vcl/settings.hxx>
28 #include <vcl/font.hxx>
29 #include <sal/macros.h>
30 #include <sal/log.hxx>
31 #include <rtl/tencinfo.h>
32 #include <svl/numformat.hxx>
33 #include <svtools/colorcfg.hxx>
34 #include <vcl/unohelp.hxx>
35 #include <editeng/svxfont.hxx>
36 #include <o3tl/unit_conversion.hxx>
39 #include <xltools.hxx>
40 // Color data =================================================================
42 /** Standard EGA colors, bright. */
43 #define EXC_PALETTE_EGA_COLORS_LIGHT \
44 Color(0x000000), Color(0xFFFFFF), Color(0xFF0000), Color(0x00FF00), Color(0x0000FF), Color(0xFFFF00), Color(0xFF00FF), Color(0x00FFFF)
45 /** Standard EGA colors, dark. */
46 #define EXC_PALETTE_EGA_COLORS_DARK \
47 Color(0x800000), Color(0x008000), Color(0x000080), Color(0x808000), Color(0x800080), Color(0x008080), Color(0xC0C0C0), Color(0x808080)
49 /** Default color table for BIFF2. */
50 const Color spnDefColorTable2
[] =
52 /* 0 */ EXC_PALETTE_EGA_COLORS_LIGHT
55 /** Default color table for BIFF3/BIFF4. */
56 const Color spnDefColorTable3
[] =
58 /* 0 */ EXC_PALETTE_EGA_COLORS_LIGHT
,
59 /* 8 */ EXC_PALETTE_EGA_COLORS_LIGHT
,
60 /* 16 */ EXC_PALETTE_EGA_COLORS_DARK
63 /** Default color table for BIFF5/BIFF7. */
64 const Color spnDefColorTable5
[] =
66 /* 0 */ EXC_PALETTE_EGA_COLORS_LIGHT
,
67 /* 8 */ EXC_PALETTE_EGA_COLORS_LIGHT
,
68 /* 16 */ EXC_PALETTE_EGA_COLORS_DARK
,
69 /* 24 */ Color(0x8080FF), Color(0x802060), Color(0xFFFFC0), Color(0xA0E0E0), Color(0x600080), Color(0xFF8080), Color(0x0080C0), Color(0xC0C0FF),
70 /* 32 */ Color(0x000080), Color(0xFF00FF), Color(0xFFFF00), Color(0x00FFFF), Color(0x800080), Color(0x800000), Color(0x008080), Color(0x0000FF),
71 /* 40 */ Color(0x00CFFF), Color(0x69FFFF), Color(0xE0FFE0), Color(0xFFFF80), Color(0xA6CAF0), Color(0xDD9CB3), Color(0xB38FEE), Color(0xE3E3E3),
72 /* 48 */ Color(0x2A6FF9), Color(0x3FB8CD), Color(0x488436), Color(0x958C41), Color(0x8E5E42), Color(0xA0627A), Color(0x624FAC), Color(0x969696),
73 /* 56 */ Color(0x1D2FBE), Color(0x286676), Color(0x004500), Color(0x453E01), Color(0x6A2813), Color(0x85396A), Color(0x4A3285), Color(0x424242)
76 /** Default color table for BIFF8. */
77 const Color spnDefColorTable8
[] =
79 /* 0 */ EXC_PALETTE_EGA_COLORS_LIGHT
,
80 /* 8 */ EXC_PALETTE_EGA_COLORS_LIGHT
,
81 /* 16 */ EXC_PALETTE_EGA_COLORS_DARK
,
82 /* 24 */ Color(0x9999FF), Color(0x993366), Color(0xFFFFCC), Color(0xCCFFFF), Color(0x660066), Color(0xFF8080), Color(0x0066CC), Color(0xCCCCFF),
83 /* 32 */ Color(0x000080), Color(0xFF00FF), Color(0xFFFF00), Color(0x00FFFF), Color(0x800080), Color(0x800000), Color(0x008080), Color(0x0000FF),
84 /* 40 */ Color(0x00CCFF), Color(0xCCFFFF), Color(0xCCFFCC), Color(0xFFFF99), Color(0x99CCFF), Color(0xFF99CC), Color(0xCC99FF), Color(0xFFCC99),
85 /* 48 */ Color(0x3366FF), Color(0x33CCCC), Color(0x99CC00), Color(0xFFCC00), Color(0xFF9900), Color(0xFF6600), Color(0x666699), Color(0x969696),
86 /* 56 */ Color(0x003366), Color(0x339966), Color(0x003300), Color(0x333300), Color(0x993300), Color(0x993366), Color(0x333399), Color(0x333333)
89 #undef EXC_PALETTE_EGA_COLORS_LIGHT
90 #undef EXC_PALETTE_EGA_COLORS_DARK
92 XclDefaultPalette::XclDefaultPalette( const XclRoot
& rRoot
) :
93 mpnColorTable( nullptr ),
96 const StyleSettings
& rSett
= Application::GetSettings().GetStyleSettings();
97 mnFaceColor
= rSett
.GetFaceColor();
98 // Don't use the system HelpBack and HelpText colours as it causes problems
99 // with modern gnome. This is because mnNoteText and mnNoteBack are used
100 // when colour indices ( instead of real colours ) are specified.
101 // Note: That this it is not an unusual scenario that we get the Note
102 // background specified as a real colour and the text specified as a
103 // colour index. That means the text colour would be picked from
104 // the system where the note background would be picked from a real colour.
105 // Previously the note text colour was picked from the system tooltip
106 // text colour, on modern gnome(e.g. 3) that tends to be 'white' with the
108 // Using the Libreoffice defaults ( instead of system specific colours
109 // ) lessens the chance of the one colour being an unsuitable combination
110 // because by default the note text is black and the note background is
111 // a light yellow colour ( very similar to Excel's normal defaults )
112 mnNoteText
= svtools::ColorConfig::GetDefaultColor( svtools::FONTCOLOR
);
113 mnNoteBack
= svtools::ColorConfig::GetDefaultColor( svtools::CALCNOTESBACKGROUND
);
116 switch( rRoot
.GetBiff() )
119 mpnColorTable
= spnDefColorTable2
;
120 mnTableSize
= std::size( spnDefColorTable2
);
124 mpnColorTable
= spnDefColorTable3
;
125 mnTableSize
= std::size( spnDefColorTable3
);
128 mpnColorTable
= spnDefColorTable5
;
129 mnTableSize
= std::size( spnDefColorTable5
);
132 mpnColorTable
= spnDefColorTable8
;
133 mnTableSize
= std::size( spnDefColorTable8
);
140 Color
XclDefaultPalette::GetDefColor( sal_uInt16 nXclIndex
) const
143 if( nXclIndex
< mnTableSize
)
144 nColor
= mpnColorTable
[ nXclIndex
];
145 else switch( nXclIndex
)
147 case EXC_COLOR_WINDOWTEXT3
:
148 case EXC_COLOR_WINDOWTEXT
:
149 case EXC_COLOR_CHWINDOWTEXT
: nColor
= COL_BLACK
; break;
150 case EXC_COLOR_WINDOWBACK3
:
151 case EXC_COLOR_WINDOWBACK
:
152 case EXC_COLOR_CHWINDOWBACK
: nColor
= COL_WHITE
; break;
153 case EXC_COLOR_BUTTONBACK
: nColor
= mnFaceColor
; break;
154 case EXC_COLOR_CHBORDERAUTO
: nColor
= COL_BLACK
; break; // TODO: really always black?
155 case EXC_COLOR_NOTEBACK
: nColor
= mnNoteBack
; break;
156 case EXC_COLOR_NOTETEXT
: nColor
= mnNoteText
; break;
157 case EXC_COLOR_FONTAUTO
: nColor
= COL_AUTO
; break;
159 SAL_WARN("sc", "XclDefaultPalette::GetDefColor - unknown default color index: " << nXclIndex
);
165 // Font Data ==================================================================
167 namespace Awt
= css::awt
;
168 namespace AwtFontFamily
= Awt::FontFamily
;
169 namespace AwtFontLineStyle
= Awt::FontUnderline
;
170 namespace AwtFontStrikeout
= Awt::FontStrikeout
;
172 XclFontData::XclFontData()
177 XclFontData::XclFontData(const vcl::Font
& rFont
, model::ComplexColor
const& rComplexColor
)
180 FillFromVclFont(rFont
, rComplexColor
);
183 XclFontData::XclFontData(const SvxFont
& rFont
, model::ComplexColor
const& rComplexColor
)
185 FillFromSvxFont(rFont
, rComplexColor
);
188 void XclFontData::Clear()
192 maComplexColor
.setColor(COL_AUTO
);
194 mnWeight
= EXC_FONTWGHT_DONTKNOW
;
195 mnEscapem
= EXC_FONTESC_NONE
;
196 mnFamily
= EXC_FONTFAM_SYSTEM
;
197 mnCharSet
= EXC_FONTCSET_ANSI_LATIN
;
198 mnUnderline
= EXC_FONTUNDERL_NONE
;
199 mbItalic
= mbStrikeout
= mbOutline
= mbShadow
= false;
202 void XclFontData::FillFromVclFont(const vcl::Font
& rFont
, model::ComplexColor
const& rComplexColor
)
204 maName
= XclTools::GetXclFontName( rFont
.GetFamilyName() ); // substitute with MS fonts
206 SetScUnderline( rFont
.GetUnderline() );
207 mnEscapem
= EXC_FONTESC_NONE
;
208 SetScHeight( rFont
.GetFontSize().Height() );
209 SetScWeight( rFont
.GetWeight() );
210 SetScFamily( rFont
.GetFamilyType() );
211 SetFontEncoding( rFont
.GetCharSet() );
212 SetScPosture( rFont
.GetItalic() );
213 SetScStrikeout( rFont
.GetStrikeout() );
214 mbOutline
= rFont
.IsOutline();
215 mbShadow
= rFont
.IsShadow();
217 maComplexColor
= rComplexColor
;
220 void XclFontData::FillFromSvxFont(const SvxFont
& rFont
, model::ComplexColor
const& rComplexColor
)
222 FillFromVclFont(rFont
, rComplexColor
);
223 SetScEscapement(rFont
.GetEscapement());
226 // *** conversion of VCL/SVX constants *** ------------------------------------
228 FontFamily
XclFontData::GetScFamily( rtl_TextEncoding eDefTextEnc
) const
230 FontFamily eScFamily
;
231 // ! format differs from Windows documentation: family is in lower nibble, pitch unknown
232 switch( mnFamily
& 0x0F )
234 case EXC_FONTFAM_ROMAN
: eScFamily
= FAMILY_ROMAN
; break;
235 case EXC_FONTFAM_SWISS
: eScFamily
= FAMILY_SWISS
; break;
236 case EXC_FONTFAM_MODERN
: eScFamily
= FAMILY_MODERN
; break;
237 case EXC_FONTFAM_SCRIPT
: eScFamily
= FAMILY_SCRIPT
; break;
238 case EXC_FONTFAM_DECORATIVE
: eScFamily
= FAMILY_DECORATIVE
; break;
241 ((eDefTextEnc
== RTL_TEXTENCODING_APPLE_ROMAN
) &&
242 (maName
.equalsIgnoreAsciiCase( "Geneva" ) || maName
.equalsIgnoreAsciiCase( "Chicago" ))) ?
243 FAMILY_SWISS
: FAMILY_DONTKNOW
;
248 rtl_TextEncoding
XclFontData::GetFontEncoding() const
250 // convert Windows character set to text encoding identifier
251 return rtl_getTextEncodingFromWindowsCharset( mnCharSet
);
254 FontItalic
XclFontData::GetScPosture() const
256 return mbItalic
? ITALIC_NORMAL
: ITALIC_NONE
;
259 FontWeight
XclFontData::GetScWeight() const
261 FontWeight eScWeight
;
263 if( !mnWeight
) eScWeight
= WEIGHT_DONTKNOW
;
264 else if( mnWeight
< 150 ) eScWeight
= WEIGHT_THIN
;
265 else if( mnWeight
< 250 ) eScWeight
= WEIGHT_ULTRALIGHT
;
266 else if( mnWeight
< 325 ) eScWeight
= WEIGHT_LIGHT
;
267 else if( mnWeight
< 375 ) eScWeight
= WEIGHT_SEMILIGHT
;
268 else if( mnWeight
< 450 ) eScWeight
= WEIGHT_NORMAL
;
269 else if( mnWeight
< 550 ) eScWeight
= WEIGHT_MEDIUM
;
270 else if( mnWeight
< 650 ) eScWeight
= WEIGHT_SEMIBOLD
;
271 else if( mnWeight
< 750 ) eScWeight
= WEIGHT_BOLD
;
272 else if( mnWeight
< 850 ) eScWeight
= WEIGHT_ULTRABOLD
;
273 else eScWeight
= WEIGHT_BLACK
;
278 FontLineStyle
XclFontData::GetScUnderline() const
280 FontLineStyle eScUnderl
= LINESTYLE_NONE
;
281 switch( mnUnderline
)
283 case EXC_FONTUNDERL_SINGLE
:
284 case EXC_FONTUNDERL_SINGLE_ACC
: eScUnderl
= LINESTYLE_SINGLE
; break;
285 case EXC_FONTUNDERL_DOUBLE
:
286 case EXC_FONTUNDERL_DOUBLE_ACC
: eScUnderl
= LINESTYLE_DOUBLE
; break;
291 SvxEscapement
XclFontData::GetScEscapement() const
293 SvxEscapement eScEscapem
= SvxEscapement::Off
;
296 case EXC_FONTESC_SUPER
: eScEscapem
= SvxEscapement::Superscript
; break;
297 case EXC_FONTESC_SUB
: eScEscapem
= SvxEscapement::Subscript
; break;
302 FontStrikeout
XclFontData::GetScStrikeout() const
304 return mbStrikeout
? STRIKEOUT_SINGLE
: STRIKEOUT_NONE
;
307 void XclFontData::SetScHeight( sal_Int32 nTwips
)
309 mnHeight
= static_cast< sal_uInt16
>( ::std::min( nTwips
, static_cast<sal_Int32
>(0x7FFFL
) ) );
312 void XclFontData::SetScFamily( FontFamily eScFamily
)
316 case FAMILY_DONTKNOW
: mnFamily
= EXC_FONTFAM_DONTKNOW
; break;
317 case FAMILY_DECORATIVE
: mnFamily
= EXC_FONTFAM_DECORATIVE
; break;
318 case FAMILY_MODERN
: mnFamily
= EXC_FONTFAM_MODERN
; break;
319 case FAMILY_ROMAN
: mnFamily
= EXC_FONTFAM_ROMAN
; break;
320 case FAMILY_SCRIPT
: mnFamily
= EXC_FONTFAM_SCRIPT
; break;
321 case FAMILY_SWISS
: mnFamily
= EXC_FONTFAM_SWISS
; break;
322 case FAMILY_SYSTEM
: mnFamily
= EXC_FONTFAM_SYSTEM
; break;
324 OSL_FAIL( "XclFontData::SetScFamily - unknown font family" );
325 mnFamily
= EXC_FONTFAM_DONTKNOW
;
329 void XclFontData::SetFontEncoding( rtl_TextEncoding eFontEnc
)
331 // convert text encoding identifier to Windows character set
332 mnCharSet
= rtl_getBestWindowsCharsetFromTextEncoding( eFontEnc
);
335 void XclFontData::SetScPosture( FontItalic eScPosture
)
337 mbItalic
= (eScPosture
== ITALIC_OBLIQUE
) || (eScPosture
== ITALIC_NORMAL
);
340 void XclFontData::SetScWeight( FontWeight eScWeight
)
344 case WEIGHT_DONTKNOW
: mnWeight
= EXC_FONTWGHT_DONTKNOW
; break;
345 case WEIGHT_THIN
: mnWeight
= EXC_FONTWGHT_THIN
; break;
346 case WEIGHT_ULTRALIGHT
: mnWeight
= EXC_FONTWGHT_ULTRALIGHT
; break;
347 case WEIGHT_LIGHT
: mnWeight
= EXC_FONTWGHT_LIGHT
; break;
348 case WEIGHT_SEMILIGHT
: mnWeight
= EXC_FONTWGHT_SEMILIGHT
; break;
349 case WEIGHT_NORMAL
: mnWeight
= EXC_FONTWGHT_NORMAL
; break;
350 case WEIGHT_MEDIUM
: mnWeight
= EXC_FONTWGHT_MEDIUM
; break;
351 case WEIGHT_SEMIBOLD
: mnWeight
= EXC_FONTWGHT_SEMIBOLD
; break;
352 case WEIGHT_BOLD
: mnWeight
= EXC_FONTWGHT_BOLD
; break;
353 case WEIGHT_ULTRABOLD
: mnWeight
= EXC_FONTWGHT_ULTRABOLD
; break;
354 case WEIGHT_BLACK
: mnWeight
= EXC_FONTWGHT_BLACK
; break;
355 default: mnWeight
= EXC_FONTWGHT_NORMAL
;
359 void XclFontData::SetScUnderline( FontLineStyle eScUnderl
)
364 case LINESTYLE_DONTKNOW
: mnUnderline
= EXC_FONTUNDERL_NONE
; break;
365 case LINESTYLE_DOUBLE
:
366 case LINESTYLE_DOUBLEWAVE
: mnUnderline
= EXC_FONTUNDERL_DOUBLE
; break;
367 default: mnUnderline
= EXC_FONTUNDERL_SINGLE
;
371 void XclFontData::SetScEscapement( short nScEscapem
)
374 mnEscapem
= EXC_FONTESC_SUPER
;
375 else if( nScEscapem
< 0 )
376 mnEscapem
= EXC_FONTESC_SUB
;
378 mnEscapem
= EXC_FONTESC_NONE
;
381 void XclFontData::SetScStrikeout( FontStrikeout eScStrikeout
)
384 (eScStrikeout
== STRIKEOUT_SINGLE
) || (eScStrikeout
== STRIKEOUT_DOUBLE
) ||
385 (eScStrikeout
== STRIKEOUT_BOLD
) || (eScStrikeout
== STRIKEOUT_SLASH
) ||
386 (eScStrikeout
== STRIKEOUT_X
);
389 // *** conversion of API constants *** ----------------------------------------
391 float XclFontData::GetApiHeight() const
393 return o3tl::convert
<double>(mnHeight
, o3tl::Length::twip
, o3tl::Length::pt
);
396 sal_Int16
XclFontData::GetApiFamily() const
398 sal_Int16 nApiFamily
= AwtFontFamily::DONTKNOW
;
401 case FAMILY_DECORATIVE
: nApiFamily
= AwtFontFamily::DECORATIVE
; break;
402 case FAMILY_MODERN
: nApiFamily
= AwtFontFamily::MODERN
; break;
403 case FAMILY_ROMAN
: nApiFamily
= AwtFontFamily::ROMAN
; break;
404 case FAMILY_SCRIPT
: nApiFamily
= AwtFontFamily::SCRIPT
; break;
405 case FAMILY_SWISS
: nApiFamily
= AwtFontFamily::SWISS
; break;
406 case FAMILY_SYSTEM
: nApiFamily
= AwtFontFamily::SYSTEM
; break;
411 sal_Int16
XclFontData::GetApiFontEncoding() const
413 // API constants are equal to rtl_TextEncoding constants
414 return static_cast< sal_Int16
>( GetFontEncoding() );
417 Awt::FontSlant
XclFontData::GetApiPosture() const
419 return mbItalic
? Awt::FontSlant_ITALIC
: Awt::FontSlant_NONE
;
422 float XclFontData::GetApiWeight() const
424 return vcl::unohelper::ConvertFontWeight( GetScWeight() );
427 sal_Int16
XclFontData::GetApiUnderline() const
429 sal_Int16 nApiUnderl
= AwtFontLineStyle::NONE
;
430 switch( mnUnderline
)
432 case EXC_FONTUNDERL_SINGLE
:
433 case EXC_FONTUNDERL_SINGLE_ACC
: nApiUnderl
= AwtFontLineStyle::SINGLE
; break;
434 case EXC_FONTUNDERL_DOUBLE
:
435 case EXC_FONTUNDERL_DOUBLE_ACC
: nApiUnderl
= AwtFontLineStyle::DOUBLE
; break;
440 sal_Int16
XclFontData::GetApiEscapement() const
442 sal_Int16 nApiEscapem
= 0;
445 case EXC_FONTESC_SUPER
: nApiEscapem
= 33; break;
446 case EXC_FONTESC_SUB
: nApiEscapem
= -33; break;
451 sal_Int16
XclFontData::GetApiStrikeout() const
453 return mbStrikeout
? AwtFontStrikeout::SINGLE
: AwtFontStrikeout::NONE
;
456 void XclFontData::SetApiHeight( float fPoint
)
458 mnHeight
= std::min(o3tl::convert(fPoint
, o3tl::Length::pt
, o3tl::Length::twip
) + 0.5, 32767.0);
461 void XclFontData::SetApiFamily( sal_Int16 nApiFamily
)
465 case AwtFontFamily::DECORATIVE
: mnFamily
= FAMILY_DECORATIVE
; break;
466 case AwtFontFamily::MODERN
: mnFamily
= FAMILY_MODERN
; break;
467 case AwtFontFamily::ROMAN
: mnFamily
= FAMILY_ROMAN
; break;
468 case AwtFontFamily::SCRIPT
: mnFamily
= FAMILY_SCRIPT
; break;
469 case AwtFontFamily::SWISS
: mnFamily
= FAMILY_SWISS
; break;
470 case AwtFontFamily::SYSTEM
: mnFamily
= FAMILY_SYSTEM
; break;
471 default: mnFamily
= FAMILY_DONTKNOW
;
475 void XclFontData::SetApiPosture( Awt::FontSlant eApiPosture
)
478 (eApiPosture
== Awt::FontSlant_OBLIQUE
) ||
479 (eApiPosture
== Awt::FontSlant_ITALIC
) ||
480 (eApiPosture
== Awt::FontSlant_REVERSE_OBLIQUE
) ||
481 (eApiPosture
== Awt::FontSlant_REVERSE_ITALIC
);
484 void XclFontData::SetApiWeight( float fApiWeight
)
486 SetScWeight( vcl::unohelper::ConvertFontWeight( fApiWeight
) );
489 void XclFontData::SetApiUnderline( sal_Int16 nApiUnderl
)
493 case AwtFontLineStyle::NONE
:
494 case AwtFontLineStyle::DONTKNOW
: mnUnderline
= EXC_FONTUNDERL_NONE
; break;
495 case AwtFontLineStyle::DOUBLE
:
496 case AwtFontLineStyle::DOUBLEWAVE
: mnUnderline
= EXC_FONTUNDERL_DOUBLE
; break;
497 default: mnUnderline
= EXC_FONTUNDERL_SINGLE
;
501 void XclFontData::SetApiEscapement( sal_Int16 nApiEscapem
)
503 if( nApiEscapem
> 0 )
504 mnEscapem
= EXC_FONTESC_SUPER
;
505 else if( nApiEscapem
< 0 )
506 mnEscapem
= EXC_FONTESC_SUB
;
508 mnEscapem
= EXC_FONTESC_NONE
;
511 void XclFontData::SetApiStrikeout( sal_Int16 nApiStrikeout
)
514 (nApiStrikeout
!= AwtFontStrikeout::NONE
) &&
515 (nApiStrikeout
!= AwtFontStrikeout::DONTKNOW
);
518 bool operator==( const XclFontData
& rLeft
, const XclFontData
& rRight
)
521 (rLeft
.mnHeight
== rRight
.mnHeight
) &&
522 (rLeft
.mnWeight
== rRight
.mnWeight
) &&
523 (rLeft
.mnUnderline
== rRight
.mnUnderline
) &&
524 (rLeft
.maComplexColor
== rRight
.maComplexColor
) &&
525 (rLeft
.mnEscapem
== rRight
.mnEscapem
) &&
526 (rLeft
.mnFamily
== rRight
.mnFamily
) &&
527 (rLeft
.mnCharSet
== rRight
.mnCharSet
) &&
528 (rLeft
.mbItalic
== rRight
.mbItalic
) &&
529 (rLeft
.mbStrikeout
== rRight
.mbStrikeout
) &&
530 (rLeft
.mbOutline
== rRight
.mbOutline
) &&
531 (rLeft
.mbShadow
== rRight
.mbShadow
) &&
532 (rLeft
.maName
== rRight
.maName
);
537 /** Property names for common font settings. */
538 const char *const sppcPropNamesChCommon
[] =
540 "CharUnderline", "CharStrikeout", "CharColor", "CharContoured", "CharShadowed", nullptr
542 /** Property names for Western font settings. */
543 const char *const sppcPropNamesChWstrn
[] =
545 "CharFontName", "CharHeight", "CharPosture", "CharWeight", nullptr
547 /** Property names for Asian font settings. */
548 const char *const sppcPropNamesChAsian
[] =
550 "CharFontNameAsian", "CharHeightAsian", "CharPostureAsian", "CharWeightAsian", nullptr
552 /** Property names for Complex font settings. */
553 const char *const sppcPropNamesChCmplx
[] =
555 "CharFontNameComplex", "CharHeightComplex", "CharPostureComplex", "CharWeightComplex", nullptr
557 /** Property names for escapement. */
558 const char *const sppcPropNamesChEscapement
[] =
560 "CharEscapement", "CharEscapementHeight", nullptr
562 const sal_Int8 EXC_API_ESC_HEIGHT
= 58; /// Default escapement font height.
564 /** Property names for Western font settings without font name. */
565 const char *const *const sppcPropNamesChWstrnNoName
= sppcPropNamesChWstrn
+ 1;
566 /** Property names for Asian font settings without font name. */
567 const char *const *const sppcPropNamesChAsianNoName
= sppcPropNamesChAsian
+ 1;
568 /** Property names for Complex font settings without font name. */
569 const char *const *const sppcPropNamesChCmplxNoName
= sppcPropNamesChCmplx
+ 1;
571 /** Property names for font settings in form controls. */
572 const char *const sppcPropNamesControl
[] =
574 "FontName", "FontFamily", "FontCharset", "FontHeight", "FontSlant",
575 "FontWeight", "FontLineStyle", "FontStrikeout", "TextColor", nullptr
578 /** Inserts all passed API font settings into the font data object. */
579 void lclSetApiFontSettings( XclFontData
& rFontData
,
580 const OUString
& rApiFontName
, float fApiHeight
, float fApiWeight
,
581 Awt::FontSlant eApiPosture
, sal_Int16 nApiUnderl
, sal_Int16 nApiStrikeout
)
583 rFontData
.maName
= XclTools::GetXclFontName( rApiFontName
);
584 rFontData
.SetApiHeight( fApiHeight
);
585 rFontData
.SetApiWeight( fApiWeight
);
586 rFontData
.SetApiPosture( eApiPosture
);
587 rFontData
.SetApiUnderline( nApiUnderl
);
588 rFontData
.SetApiStrikeout( nApiStrikeout
);
591 /** Writes script dependent properties to a font property set helper. */
592 void lclWriteChartFont( ScfPropertySet
& rPropSet
,
593 ScfPropSetHelper
& rHlpName
, ScfPropSetHelper
& rHlpNoName
,
594 const XclFontData
& rFontData
, bool bHasFontName
)
596 // select the font helper
597 ScfPropSetHelper
& rPropSetHlp
= bHasFontName
? rHlpName
: rHlpNoName
;
598 // initialize the font helper (must be called before writing any properties)
599 rPropSetHlp
.InitializeWrite();
602 rPropSetHlp
<< rFontData
.maName
;
603 // write remaining properties
604 rPropSetHlp
<< rFontData
.GetApiHeight() << rFontData
.GetApiPosture() << rFontData
.GetApiWeight();
605 // write properties to property set
606 rPropSetHlp
.WriteToPropertySet( rPropSet
);
611 XclFontPropSetHelper::XclFontPropSetHelper() :
612 maHlpChCommon( sppcPropNamesChCommon
),
613 maHlpChWstrn( sppcPropNamesChWstrn
),
614 maHlpChAsian( sppcPropNamesChAsian
),
615 maHlpChCmplx( sppcPropNamesChCmplx
),
616 maHlpChWstrnNoName( sppcPropNamesChWstrnNoName
),
617 maHlpChAsianNoName( sppcPropNamesChAsianNoName
),
618 maHlpChCmplxNoName( sppcPropNamesChCmplxNoName
),
619 maHlpChEscapement( sppcPropNamesChEscapement
),
620 maHlpControl( sppcPropNamesControl
)
624 void XclFontPropSetHelper::ReadFontProperties( XclFontData
& rFontData
,
625 const ScfPropertySet
& rPropSet
, XclFontPropSetType eType
, sal_Int16 nScript
)
629 case EXC_FONTPROPSET_CHART
:
631 OUString aApiFontName
;
632 float fApiHeight
, fApiWeight
;
633 sal_Int16 nApiUnderl
= 0, nApiStrikeout
= 0;
634 Awt::FontSlant eApiPosture
;
636 // read script type dependent properties
637 ScfPropSetHelper
& rPropSetHlp
= GetChartHelper( nScript
);
638 rPropSetHlp
.ReadFromPropertySet( rPropSet
);
639 rPropSetHlp
>> aApiFontName
>> fApiHeight
>> eApiPosture
>> fApiWeight
;
640 // read common properties
641 maHlpChCommon
.ReadFromPropertySet( rPropSet
);
642 maHlpChCommon
>> nApiUnderl
;
643 maHlpChCommon
>> nApiStrikeout
;
645 maHlpChCommon
>> aColor
;
646 rFontData
.maComplexColor
.setColor(aColor
);
647 maHlpChCommon
>> rFontData
.mbOutline
;
648 maHlpChCommon
>> rFontData
.mbShadow
;
650 // convert API property values to Excel settings
651 lclSetApiFontSettings( rFontData
, aApiFontName
,
652 fApiHeight
, fApiWeight
, eApiPosture
, nApiUnderl
, nApiStrikeout
);
655 sal_Int16 nApiEscapement
= 0;
656 sal_Int8 nApiEscHeight
= 0;
657 maHlpChEscapement
.ReadFromPropertySet( rPropSet
);
658 maHlpChEscapement
.ReadFromPropertySet( rPropSet
);
659 maHlpChEscapement
.ReadFromPropertySet( rPropSet
);
660 maHlpChEscapement
>> nApiEscapement
>> nApiEscHeight
;
661 rFontData
.SetApiEscapement( nApiEscapement
);
665 case EXC_FONTPROPSET_CONTROL
:
667 OUString aApiFontName
;
668 float fApiHeight(0.0), fApiWeight(0.0);
669 sal_Int16
nApiFamily(0), nApiCharSet(0), nApiPosture(0), nApiUnderl(0), nApiStrikeout(0);
671 // read font properties
672 maHlpControl
.ReadFromPropertySet( rPropSet
);
673 maHlpControl
>> aApiFontName
;
674 maHlpControl
>> nApiFamily
;
675 maHlpControl
>> nApiCharSet
;
676 maHlpControl
>> fApiHeight
;
677 maHlpControl
>> nApiPosture
;
678 maHlpControl
>> fApiWeight
;
679 maHlpControl
>> nApiUnderl
;
680 maHlpControl
>> nApiStrikeout
;
682 maHlpControl
>> aColor
;
683 rFontData
.maComplexColor
.setColor(aColor
);
685 // convert API property values to Excel settings
686 Awt::FontSlant eApiPosture
= static_cast< Awt::FontSlant
>( nApiPosture
);
687 lclSetApiFontSettings( rFontData
, aApiFontName
,
688 fApiHeight
, fApiWeight
, eApiPosture
, nApiUnderl
, nApiStrikeout
);
689 rFontData
.SetApiFamily( nApiFamily
);
690 rFontData
.SetFontEncoding( nApiCharSet
);
696 void XclFontPropSetHelper::WriteFontProperties(
697 ScfPropertySet
& rPropSet
, XclFontPropSetType eType
,
698 const XclFontData
& rFontData
, bool bHasWstrn
, bool bHasAsian
, bool bHasCmplx
,
699 const Color
* pFontColor
)
703 case EXC_FONTPROPSET_CHART
:
705 // write common properties
706 maHlpChCommon
.InitializeWrite();
707 Color aColor
= pFontColor
? *pFontColor
: rFontData
.maComplexColor
.getFinalColor();
708 maHlpChCommon
<< rFontData
.GetApiUnderline()
709 << rFontData
.GetApiStrikeout()
711 << rFontData
.mbOutline
712 << rFontData
.mbShadow
;
713 maHlpChCommon
.WriteToPropertySet( rPropSet
);
715 // write script type dependent properties
716 lclWriteChartFont( rPropSet
, maHlpChWstrn
, maHlpChWstrnNoName
, rFontData
, bHasWstrn
);
717 lclWriteChartFont( rPropSet
, maHlpChAsian
, maHlpChAsianNoName
, rFontData
, bHasAsian
);
718 lclWriteChartFont( rPropSet
, maHlpChCmplx
, maHlpChCmplxNoName
, rFontData
, bHasCmplx
);
721 if( rFontData
.GetScEscapement() != SvxEscapement::Off
)
723 maHlpChEscapement
.InitializeWrite();
724 maHlpChEscapement
<< rFontData
.GetApiEscapement() << EXC_API_ESC_HEIGHT
;
725 maHlpChEscapement
.WriteToPropertySet( rPropSet
);
730 case EXC_FONTPROPSET_CONTROL
:
732 maHlpControl
.InitializeWrite();
733 maHlpControl
<< rFontData
.maName
734 << rFontData
.GetApiFamily()
735 << rFontData
.GetApiFontEncoding()
736 << static_cast< sal_Int16
>( rFontData
.GetApiHeight() + 0.5 )
737 << rFontData
.GetApiPosture()
738 << rFontData
.GetApiWeight()
739 << rFontData
.GetApiUnderline()
740 << rFontData
.GetApiStrikeout()
741 << rFontData
.maComplexColor
.getFinalColor();
742 maHlpControl
.WriteToPropertySet( rPropSet
);
748 ScfPropSetHelper
& XclFontPropSetHelper::GetChartHelper( sal_Int16 nScript
)
750 namespace ApiScriptType
= css::i18n::ScriptType
;
753 case ApiScriptType::LATIN
: return maHlpChWstrn
;
754 case ApiScriptType::ASIAN
: return maHlpChAsian
;
755 case ApiScriptType::COMPLEX
: return maHlpChCmplx
;
756 default: OSL_FAIL( "XclFontPropSetHelper::GetChartHelper - unknown script type" );
761 // Number formats =============================================================
765 /** Special number format index describing a reused format. */
766 const NfIndexTableOffset PRV_NF_INDEX_REUSE
= NF_INDEX_TABLE_ENTRIES
;
768 /** German primary language not defined, LANGUAGE_GERMAN belongs to Germany. */
769 constexpr LanguageType PRV_LANGUAGE_GERMAN_PRIM
= primary(LANGUAGE_GERMAN
);
770 /** French primary language not defined, LANGUAGE_FRENCH belongs to France. */
771 constexpr LanguageType PRV_LANGUAGE_FRENCH_PRIM
= primary(LANGUAGE_FRENCH
);
772 /** Parent language identifier for Asian languages. */
773 constexpr LanguageType PRV_LANGUAGE_ASIAN_PRIM
= primary(LANGUAGE_CHINESE
);
775 /** Stores the number format used in Calc for an Excel built-in number format. */
776 struct XclBuiltInFormat
778 sal_uInt16 mnXclNumFmt
; /// Excel built-in index.
779 const char* mpFormat
; /// Format string, may be 0 (meOffset used then).
780 NfIndexTableOffset meOffset
; /// SvNumberFormatter format index, if mpFormat==0.
781 sal_uInt16 mnXclReuseFmt
; /// Use this Excel format, if meOffset==PRV_NF_INDEX_REUSE.
784 /** Defines a literal Excel built-in number format. */
785 #define EXC_NUMFMT_STRING( nXclNumFmt, pcUtf8 ) \
786 { nXclNumFmt, pcUtf8, NF_NUMBER_STANDARD, 0 }
788 /** Defines an Excel built-in number format that maps to an own built-in format. */
789 #define EXC_NUMFMT_OFFSET( nXclNumFmt, eOffset ) \
790 { nXclNumFmt, nullptr, eOffset, 0 }
792 /** Defines an Excel built-in number format that is the same as the specified. */
793 #define EXC_NUMFMT_REUSE( nXclNumFmt, nXclReuse ) \
794 { nXclNumFmt, nullptr, PRV_NF_INDEX_REUSE, nXclReuse }
796 /** Terminates an Excel built-in number format table. */
797 #define EXC_NUMFMT_ENDTABLE() \
798 { EXC_FORMAT_NOTFOUND, nullptr, NF_NUMBER_STANDARD, 0 }
800 // Currency unit characters
801 #define UTF8_BAHT "\340\270\277"
802 #define UTF8_EURO "\342\202\254"
803 #define UTF8_POUND_UK "\302\243"
804 #define UTF8_SHEQEL "\342\202\252"
805 #define UTF8_WON "\357\277\246"
806 #define UTF8_YEN_CS "\357\277\245"
807 #define UTF8_YEN_JP "\302\245"
809 // Japanese/Chinese date/time characters
810 #define UTF8_CJ_YEAR "\345\271\264"
811 #define UTF8_CJ_MON "\346\234\210"
812 #define UTF8_CJ_DAY "\346\227\245"
813 #define UTF8_CJ_HOUR "\346\231\202"
814 #define UTF8_CJ_MIN "\345\210\206"
815 #define UTF8_CJ_SEC "\347\247\222"
817 // Chinese Simplified date/time characters
818 #define UTF8_CS_HOUR "\346\227\266"
820 // Korean date/time characters
821 #define UTF8_KO_YEAR "\353\205\204"
822 #define UTF8_KO_MON "\354\233\224"
823 #define UTF8_KO_DAY "\354\235\274"
824 #define UTF8_KO_HOUR "\354\213\234"
825 #define UTF8_KO_MIN "\353\266\204"
826 #define UTF8_KO_SEC "\354\264\210"
828 /** Default number format table. Last parent of all other tables, used for unknown languages. */
829 const XclBuiltInFormat spBuiltInFormats_DONTKNOW
[] =
831 EXC_NUMFMT_OFFSET( 0, NF_NUMBER_STANDARD
), // General
832 EXC_NUMFMT_OFFSET( 1, NF_NUMBER_INT
), // 0
833 EXC_NUMFMT_OFFSET( 2, NF_NUMBER_DEC2
), // 0.00
834 EXC_NUMFMT_OFFSET( 3, NF_NUMBER_1000INT
), // #,##0
835 EXC_NUMFMT_OFFSET( 4, NF_NUMBER_1000DEC2
), // #,##0.00
836 // 5...8 contained in file
837 EXC_NUMFMT_OFFSET( 9, NF_PERCENT_INT
), // 0%
838 EXC_NUMFMT_OFFSET( 10, NF_PERCENT_DEC2
), // 0.00%
839 EXC_NUMFMT_OFFSET( 11, NF_SCIENTIFIC_000E00
), // 0.00E+00
840 EXC_NUMFMT_OFFSET( 12, NF_FRACTION_1D
), // # ?/?
841 EXC_NUMFMT_OFFSET( 13, NF_FRACTION_2D
), // # ??/??
843 // 14...22 date and time formats
844 EXC_NUMFMT_OFFSET( 14, NF_DATE_SYS_DDMMYYYY
),
845 EXC_NUMFMT_OFFSET( 15, NF_DATE_SYS_DMMMYY
),
846 EXC_NUMFMT_OFFSET( 16, NF_DATE_SYS_DDMMM
),
847 EXC_NUMFMT_OFFSET( 17, NF_DATE_SYS_MMYY
),
848 EXC_NUMFMT_OFFSET( 18, NF_TIME_HHMMAMPM
),
849 EXC_NUMFMT_OFFSET( 19, NF_TIME_HHMMSSAMPM
),
850 EXC_NUMFMT_OFFSET( 20, NF_TIME_HHMM
),
851 EXC_NUMFMT_OFFSET( 21, NF_TIME_HHMMSS
),
852 EXC_NUMFMT_OFFSET( 22, NF_DATETIME_SYSTEM_SHORT_HHMM
),
854 // 23...36 international formats
855 EXC_NUMFMT_REUSE( 23, 0 ),
856 EXC_NUMFMT_REUSE( 24, 0 ),
857 EXC_NUMFMT_REUSE( 25, 0 ),
858 EXC_NUMFMT_REUSE( 26, 0 ),
859 EXC_NUMFMT_REUSE( 27, 14 ),
860 EXC_NUMFMT_REUSE( 28, 14 ),
861 EXC_NUMFMT_REUSE( 29, 14 ),
862 EXC_NUMFMT_REUSE( 30, 14 ),
863 EXC_NUMFMT_REUSE( 31, 14 ),
864 EXC_NUMFMT_REUSE( 32, 21 ),
865 EXC_NUMFMT_REUSE( 33, 21 ),
866 EXC_NUMFMT_REUSE( 34, 21 ),
867 EXC_NUMFMT_REUSE( 35, 21 ),
868 EXC_NUMFMT_REUSE( 36, 14 ),
870 // 37...44 accounting formats
871 // 41...44 contained in file
872 EXC_NUMFMT_STRING( 37, "#,##0;-#,##0" ),
873 EXC_NUMFMT_STRING( 38, "#,##0;[RED]-#,##0" ),
874 EXC_NUMFMT_STRING( 39, "#,##0.00;-#,##0.00" ),
875 EXC_NUMFMT_STRING( 40, "#,##0.00;[RED]-#,##0.00" ),
877 // 45...49 more special formats
878 EXC_NUMFMT_STRING( 45, "mm:ss" ),
879 EXC_NUMFMT_STRING( 46, "[h]:mm:ss" ),
880 EXC_NUMFMT_STRING( 47, "mm:ss.0" ),
881 EXC_NUMFMT_STRING( 48, "##0.0E+0" ),
882 EXC_NUMFMT_OFFSET( 49, NF_TEXT
),
884 // 50...81 international formats
885 EXC_NUMFMT_REUSE( 50, 14 ),
886 EXC_NUMFMT_REUSE( 51, 14 ),
887 EXC_NUMFMT_REUSE( 52, 14 ),
888 EXC_NUMFMT_REUSE( 53, 14 ),
889 EXC_NUMFMT_REUSE( 54, 14 ),
890 EXC_NUMFMT_REUSE( 55, 14 ),
891 EXC_NUMFMT_REUSE( 56, 14 ),
892 EXC_NUMFMT_REUSE( 57, 14 ),
893 EXC_NUMFMT_REUSE( 58, 14 ),
894 EXC_NUMFMT_REUSE( 59, 1 ),
895 EXC_NUMFMT_REUSE( 60, 2 ),
896 EXC_NUMFMT_REUSE( 61, 3 ),
897 EXC_NUMFMT_REUSE( 62, 4 ),
898 EXC_NUMFMT_REUSE( 67, 9 ),
899 EXC_NUMFMT_REUSE( 68, 10 ),
900 EXC_NUMFMT_REUSE( 69, 12 ),
901 EXC_NUMFMT_REUSE( 70, 13 ),
902 EXC_NUMFMT_REUSE( 71, 14 ),
903 EXC_NUMFMT_REUSE( 72, 14 ),
904 EXC_NUMFMT_REUSE( 73, 15 ),
905 EXC_NUMFMT_REUSE( 74, 16 ),
906 EXC_NUMFMT_REUSE( 75, 17 ),
907 EXC_NUMFMT_REUSE( 76, 20 ),
908 EXC_NUMFMT_REUSE( 77, 21 ),
909 EXC_NUMFMT_REUSE( 78, 22 ),
910 EXC_NUMFMT_REUSE( 79, 45 ),
911 EXC_NUMFMT_REUSE( 80, 46 ),
912 EXC_NUMFMT_REUSE( 81, 47 ),
914 // 82...163 not used, must not occur in a file (Excel may crash)
916 EXC_NUMFMT_ENDTABLE()
919 // ENGLISH --------------------------------------------------------------------
921 /** Base table for English locales. */
922 const XclBuiltInFormat spBuiltInFormats_ENGLISH
[] =
924 EXC_NUMFMT_STRING( 15, "DD-MMM-YY" ),
925 EXC_NUMFMT_STRING( 16, "DD-MMM" ),
926 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
927 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
928 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
929 EXC_NUMFMT_STRING( 22, "DD/MM/YYYY hh:mm" ),
930 EXC_NUMFMT_ENDTABLE()
933 const XclBuiltInFormat spBuiltInFormats_ENGLISH_UK
[] =
935 EXC_NUMFMT_STRING( 63, UTF8_POUND_UK
"#,##0;-" UTF8_POUND_UK
"#,##0" ),
936 EXC_NUMFMT_STRING( 64, UTF8_POUND_UK
"#,##0;[RED]-" UTF8_POUND_UK
"#,##0" ),
937 EXC_NUMFMT_STRING( 65, UTF8_POUND_UK
"#,##0.00;-" UTF8_POUND_UK
"#,##0.00" ),
938 EXC_NUMFMT_STRING( 66, UTF8_POUND_UK
"#,##0.00;[RED]-" UTF8_POUND_UK
"#,##0.00" ),
939 EXC_NUMFMT_ENDTABLE()
942 const XclBuiltInFormat spBuiltInFormats_ENGLISH_EIRE
[] =
944 EXC_NUMFMT_STRING( 63, UTF8_EURO
"#,##0;-" UTF8_EURO
"#,##0" ),
945 EXC_NUMFMT_STRING( 64, UTF8_EURO
"#,##0;[RED]-" UTF8_EURO
"#,##0" ),
946 EXC_NUMFMT_STRING( 65, UTF8_EURO
"#,##0.00;-" UTF8_EURO
"#,##0.00" ),
947 EXC_NUMFMT_STRING( 66, UTF8_EURO
"#,##0.00;[RED]-" UTF8_EURO
"#,##0.00" ),
948 EXC_NUMFMT_ENDTABLE()
951 const XclBuiltInFormat spBuiltInFormats_ENGLISH_US
[] =
953 EXC_NUMFMT_STRING( 14, "M/D/YYYY" ),
954 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
955 EXC_NUMFMT_STRING( 16, "D-MMM" ),
956 EXC_NUMFMT_STRING( 20, "h:mm" ),
957 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
958 EXC_NUMFMT_STRING( 22, "M/D/YYYY h:mm" ),
959 EXC_NUMFMT_STRING( 37, "#,##0_);(#,##0)" ),
960 EXC_NUMFMT_STRING( 38, "#,##0_);[RED](#,##0)" ),
961 EXC_NUMFMT_STRING( 39, "#,##0.00_);(#,##0.00)" ),
962 EXC_NUMFMT_STRING( 40, "#,##0.00_);[RED](#,##0.00)" ),
963 EXC_NUMFMT_STRING( 63, "$#,##0_);($#,##0)" ),
964 EXC_NUMFMT_STRING( 64, "$#,##0_);[RED]($#,##0)" ),
965 EXC_NUMFMT_STRING( 65, "$#,##0.00_);($#,##0.00)" ),
966 EXC_NUMFMT_STRING( 66, "$#,##0.00_);[RED]($#,##0.00)" ),
967 EXC_NUMFMT_ENDTABLE()
970 const XclBuiltInFormat spBuiltInFormats_ENGLISH_CAN
[] =
972 EXC_NUMFMT_STRING( 20, "h:mm" ),
973 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
974 EXC_NUMFMT_STRING( 22, "DD/MM/YYYY h:mm" ),
975 EXC_NUMFMT_STRING( 63, "$#,##0;-$#,##0" ),
976 EXC_NUMFMT_STRING( 64, "$#,##0;[RED]-$#,##0" ),
977 EXC_NUMFMT_STRING( 65, "$#,##0.00;-$#,##0.00" ),
978 EXC_NUMFMT_STRING( 66, "$#,##0.00;[RED]-$#,##0.00" ),
979 EXC_NUMFMT_ENDTABLE()
982 const XclBuiltInFormat spBuiltInFormats_ENGLISH_AUS
[] =
984 EXC_NUMFMT_STRING( 14, "D/MM/YYYY" ),
985 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
986 EXC_NUMFMT_STRING( 16, "D-MMM" ),
987 EXC_NUMFMT_STRING( 20, "h:mm" ),
988 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
989 EXC_NUMFMT_STRING( 22, "D/MM/YYYY h:mm" ),
990 EXC_NUMFMT_STRING( 63, "$#,##0;-$#,##0" ),
991 EXC_NUMFMT_STRING( 64, "$#,##0;[RED]-$#,##0" ),
992 EXC_NUMFMT_STRING( 65, "$#,##0.00;-$#,##0.00" ),
993 EXC_NUMFMT_STRING( 66, "$#,##0.00;[RED]-$#,##0.00" ),
994 EXC_NUMFMT_ENDTABLE()
997 const XclBuiltInFormat spBuiltInFormats_ENGLISH_SAFRICA
[] =
999 EXC_NUMFMT_STRING( 14, "YYYY/MM/DD" ),
1000 EXC_NUMFMT_OFFSET( 18, NF_TIME_HHMMAMPM
),
1001 EXC_NUMFMT_OFFSET( 19, NF_TIME_HHMMSSAMPM
),
1002 EXC_NUMFMT_STRING( 22, "YYYY/MM/DD hh:mm" ),
1003 EXC_NUMFMT_STRING( 63, "\\R #,##0;\\R -#,##0" ),
1004 EXC_NUMFMT_STRING( 64, "\\R #,##0;[RED]\\R -#,##0" ),
1005 EXC_NUMFMT_STRING( 65, "\\R #,##0.00;\\R -#,##0.00" ),
1006 EXC_NUMFMT_STRING( 66, "\\R #,##0.00;[RED]\\R -#,##0.00" ),
1007 EXC_NUMFMT_ENDTABLE()
1010 // FRENCH ---------------------------------------------------------------------
1012 /** Base table for French locales. */
1013 const XclBuiltInFormat spBuiltInFormats_FRENCH
[] =
1015 EXC_NUMFMT_STRING( 15, "DD-MMM-YY" ),
1016 EXC_NUMFMT_STRING( 16, "DD-MMM" ),
1017 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1018 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1019 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1020 EXC_NUMFMT_ENDTABLE()
1023 const XclBuiltInFormat spBuiltInFormats_FRENCH_FRANCE
[] =
1025 EXC_NUMFMT_STRING( 22, "DD/MM/YYYY hh:mm" ),
1026 EXC_NUMFMT_STRING( 37, "#,##0\\ _" UTF8_EURO
";-#,##0\\ _" UTF8_EURO
),
1027 EXC_NUMFMT_STRING( 38, "#,##0\\ _" UTF8_EURO
";[RED]-#,##0\\ _" UTF8_EURO
),
1028 EXC_NUMFMT_STRING( 39, "#,##0.00\\ _" UTF8_EURO
";-#,##0.00\\ _" UTF8_EURO
),
1029 EXC_NUMFMT_STRING( 40, "#,##0.00\\ _" UTF8_EURO
";[RED]-#,##0.00\\ _" UTF8_EURO
),
1030 EXC_NUMFMT_STRING( 63, "#,##0\\ " UTF8_EURO
";-#,##0\\ " UTF8_EURO
),
1031 EXC_NUMFMT_STRING( 64, "#,##0\\ " UTF8_EURO
";[RED]-#,##0\\ " UTF8_EURO
),
1032 EXC_NUMFMT_STRING( 65, "#,##0.00\\ " UTF8_EURO
";-#,##0.00\\ " UTF8_EURO
),
1033 EXC_NUMFMT_STRING( 66, "#,##0.00\\ " UTF8_EURO
";[RED]-#,##0.00\\ " UTF8_EURO
),
1034 EXC_NUMFMT_ENDTABLE()
1037 const XclBuiltInFormat spBuiltInFormats_FRENCH_CANADIAN
[] =
1039 EXC_NUMFMT_STRING( 22, "YYYY-MM-DD hh:mm" ),
1040 EXC_NUMFMT_STRING( 37, "#,##0\\ _$_-;#,##0\\ _$-" ),
1041 EXC_NUMFMT_STRING( 38, "#,##0\\ _$_-;[RED]#,##0\\ _$-" ),
1042 EXC_NUMFMT_STRING( 39, "#,##0.00\\ _$_-;#,##0.00\\ _$-" ),
1043 EXC_NUMFMT_STRING( 40, "#,##0.00\\ _$_-;[RED]#,##0.00\\ _$-" ),
1044 EXC_NUMFMT_STRING( 63, "#,##0\\ $_-;#,##0\\ $-" ),
1045 EXC_NUMFMT_STRING( 64, "#,##0\\ $_-;[RED]#,##0\\ $-" ),
1046 EXC_NUMFMT_STRING( 65, "#,##0.00\\ $_-;#,##0.00\\ $-" ),
1047 EXC_NUMFMT_STRING( 66, "#,##0.00\\ $_-;[RED]#,##0.00\\ $-" ),
1048 EXC_NUMFMT_ENDTABLE()
1051 const XclBuiltInFormat spBuiltInFormats_FRENCH_SWISS
[] =
1053 EXC_NUMFMT_STRING( 15, "DD.MMM.YY" ),
1054 EXC_NUMFMT_STRING( 16, "DD.MMM" ),
1055 EXC_NUMFMT_STRING( 17, "MMM.YY" ),
1056 EXC_NUMFMT_STRING( 22, "DD.MM.YYYY hh:mm" ),
1057 EXC_NUMFMT_STRING( 63, "\"SFr. \"#,##0;\"SFr. \"-#,##0" ),
1058 EXC_NUMFMT_STRING( 64, "\"SFr. \"#,##0;[RED]\"SFr. \"-#,##0" ),
1059 EXC_NUMFMT_STRING( 65, "\"SFr. \"#,##0.00;\"SFr. \"-#,##0.00" ),
1060 EXC_NUMFMT_STRING( 66, "\"SFr. \"#,##0.00;[RED]\"SFr. \"-#,##0.00" ),
1061 EXC_NUMFMT_ENDTABLE()
1064 const XclBuiltInFormat spBuiltInFormats_FRENCH_BELGIAN
[] =
1066 EXC_NUMFMT_STRING( 14, "D/MM/YYYY" ),
1067 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1068 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1069 EXC_NUMFMT_STRING( 20, "h:mm" ),
1070 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
1071 EXC_NUMFMT_STRING( 22, "D/MM/YYYY h:mm" ),
1072 EXC_NUMFMT_ENDTABLE()
1075 // GERMAN ---------------------------------------------------------------------
1077 /** Base table for German locales. */
1078 const XclBuiltInFormat spBuiltInFormats_GERMAN
[] =
1080 EXC_NUMFMT_STRING( 15, "DD. MMM YY" ),
1081 EXC_NUMFMT_STRING( 16, "DD. MMM" ),
1082 EXC_NUMFMT_STRING( 17, "MMM YY" ),
1083 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1084 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1085 EXC_NUMFMT_STRING( 22, "DD.MM.YYYY hh:mm" ),
1086 EXC_NUMFMT_ENDTABLE()
1089 const XclBuiltInFormat spBuiltInFormats_GERMAN_GERMANY
[] =
1091 EXC_NUMFMT_STRING( 37, "#,##0 _" UTF8_EURO
";-#,##0 _" UTF8_EURO
),
1092 EXC_NUMFMT_STRING( 38, "#,##0 _" UTF8_EURO
";[RED]-#,##0 _" UTF8_EURO
),
1093 EXC_NUMFMT_STRING( 39, "#,##0.00 _" UTF8_EURO
";-#,##0.00 _" UTF8_EURO
),
1094 EXC_NUMFMT_STRING( 40, "#,##0.00 _" UTF8_EURO
";[RED]-#,##0.00 _" UTF8_EURO
),
1095 EXC_NUMFMT_STRING( 63, "#,##0 " UTF8_EURO
";-#,##0 " UTF8_EURO
),
1096 EXC_NUMFMT_STRING( 64, "#,##0 " UTF8_EURO
";[RED]-#,##0 " UTF8_EURO
),
1097 EXC_NUMFMT_STRING( 65, "#,##0.00 " UTF8_EURO
";-#,##0.00 " UTF8_EURO
),
1098 EXC_NUMFMT_STRING( 66, "#,##0.00 " UTF8_EURO
";[RED]-#,##0.00 " UTF8_EURO
),
1099 EXC_NUMFMT_ENDTABLE()
1102 const XclBuiltInFormat spBuiltInFormats_GERMAN_AUSTRIAN
[] =
1104 EXC_NUMFMT_STRING( 15, "DD.MMM.YY" ),
1105 EXC_NUMFMT_STRING( 16, "DD.MMM" ),
1106 EXC_NUMFMT_STRING( 17, "MMM.YY" ),
1107 EXC_NUMFMT_STRING( 63, UTF8_EURO
" #,##0;-" UTF8_EURO
" #,##0" ),
1108 EXC_NUMFMT_STRING( 64, UTF8_EURO
" #,##0;[RED]-" UTF8_EURO
" #,##0" ),
1109 EXC_NUMFMT_STRING( 65, UTF8_EURO
" #,##0.00;-" UTF8_EURO
" #,##0.00" ),
1110 EXC_NUMFMT_STRING( 66, UTF8_EURO
" #,##0.00;[RED]-" UTF8_EURO
" #,##0.00" ),
1111 EXC_NUMFMT_ENDTABLE()
1114 const XclBuiltInFormat spBuiltInFormats_GERMAN_SWISS
[] =
1116 EXC_NUMFMT_STRING( 63, "\"SFr. \"#,##0;\"SFr. \"-#,##0" ),
1117 EXC_NUMFMT_STRING( 64, "\"SFr. \"#,##0;[RED]\"SFr. \"-#,##0" ),
1118 EXC_NUMFMT_STRING( 65, "\"SFr. \"#,##0.00;\"SFr. \"-#,##0.00" ),
1119 EXC_NUMFMT_STRING( 66, "\"SFr. \"#,##0.00;[RED]\"SFr. \"-#,##0.00" ),
1120 EXC_NUMFMT_ENDTABLE()
1123 const XclBuiltInFormat spBuiltInFormats_GERMAN_LUXEMBOURG
[] =
1125 EXC_NUMFMT_STRING( 15, "DD.MMM.YY" ),
1126 EXC_NUMFMT_STRING( 16, "DD.MMM" ),
1127 EXC_NUMFMT_STRING( 17, "MMM.YY" ),
1128 EXC_NUMFMT_STRING( 37, "#,##0 _" UTF8_EURO
";-#,##0 _" UTF8_EURO
),
1129 EXC_NUMFMT_STRING( 38, "#,##0 _" UTF8_EURO
";[RED]-#,##0 _" UTF8_EURO
),
1130 EXC_NUMFMT_STRING( 39, "#,##0.00 _" UTF8_EURO
";-#,##0.00 _" UTF8_EURO
),
1131 EXC_NUMFMT_STRING( 40, "#,##0.00 _" UTF8_EURO
";[RED]-#,##0.00 _" UTF8_EURO
),
1132 EXC_NUMFMT_STRING( 63, "#,##0 " UTF8_EURO
";-#,##0 " UTF8_EURO
),
1133 EXC_NUMFMT_STRING( 64, "#,##0 " UTF8_EURO
";[RED]-#,##0 " UTF8_EURO
),
1134 EXC_NUMFMT_STRING( 65, "#,##0.00 " UTF8_EURO
";-#,##0.00 " UTF8_EURO
),
1135 EXC_NUMFMT_STRING( 66, "#,##0.00 " UTF8_EURO
";[RED]-#,##0.00 " UTF8_EURO
),
1136 EXC_NUMFMT_ENDTABLE()
1139 const XclBuiltInFormat spBuiltInFormats_GERMAN_LIECHTENSTEIN
[] =
1141 EXC_NUMFMT_STRING( 63, "\"CHF \"#,##0;\"CHF \"-#,##0" ),
1142 EXC_NUMFMT_STRING( 64, "\"CHF \"#,##0;[RED]\"CHF \"-#,##0" ),
1143 EXC_NUMFMT_STRING( 65, "\"CHF \"#,##0.00;\"CHF \"-#,##0.00" ),
1144 EXC_NUMFMT_STRING( 66, "\"CHF \"#,##0.00;[RED]\"CHF \"-#,##0.00" ),
1145 EXC_NUMFMT_ENDTABLE()
1148 // ITALIAN --------------------------------------------------------------------
1150 const XclBuiltInFormat spBuiltInFormats_ITALIAN_ITALY
[] =
1152 EXC_NUMFMT_STRING( 15, "DD-MMM-YY" ),
1153 EXC_NUMFMT_STRING( 16, "DD-MMM" ),
1154 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1155 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1156 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1157 EXC_NUMFMT_STRING( 20, "h:mm" ),
1158 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
1159 EXC_NUMFMT_STRING( 22, "DD/MM/YYYY h:mm" ),
1160 EXC_NUMFMT_STRING( 63, UTF8_EURO
" #,##0;-" UTF8_EURO
" #,##0" ),
1161 EXC_NUMFMT_STRING( 64, UTF8_EURO
" #,##0;[RED]-" UTF8_EURO
" #,##0" ),
1162 EXC_NUMFMT_STRING( 65, UTF8_EURO
" #,##0.00;-" UTF8_EURO
" #,##0.00" ),
1163 EXC_NUMFMT_STRING( 66, UTF8_EURO
" #,##0.00;[RED]-" UTF8_EURO
" #,##0.00" ),
1164 EXC_NUMFMT_ENDTABLE()
1167 const XclBuiltInFormat spBuiltInFormats_ITALIAN_SWISS
[] =
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( 22, "DD.MM.YYYY hh:mm" ),
1175 EXC_NUMFMT_STRING( 63, "\"SFr. \"#,##0;\"SFr. \"-#,##0" ),
1176 EXC_NUMFMT_STRING( 64, "\"SFr. \"#,##0;[RED]\"SFr. \"-#,##0" ),
1177 EXC_NUMFMT_STRING( 65, "\"SFr. \"#,##0.00;\"SFr. \"-#,##0.00" ),
1178 EXC_NUMFMT_STRING( 66, "\"SFr. \"#,##0.00;[RED]\"SFr. \"-#,##0.00" ),
1179 EXC_NUMFMT_ENDTABLE()
1182 // SWEDISH --------------------------------------------------------------------
1184 const XclBuiltInFormat spBuiltInFormats_SWEDISH_SWEDEN
[] =
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, "YYYY-MM-DD hh:mm" ),
1192 EXC_NUMFMT_STRING( 37, "#,##0 _k_r;-#,##0 _k_r" ),
1193 EXC_NUMFMT_STRING( 38, "#,##0 _k_r;[RED]-#,##0 _k_r" ),
1194 EXC_NUMFMT_STRING( 39, "#,##0.00 _k_r;-#,##0.00 _k_r" ),
1195 EXC_NUMFMT_STRING( 40, "#,##0.00 _k_r;[RED]-#,##0.00 _k_r" ),
1196 EXC_NUMFMT_STRING( 63, "#,##0 \"kr\";-#,##0 \"kr\"" ),
1197 EXC_NUMFMT_STRING( 64, "#,##0 \"kr\";[RED]-#,##0 \"kr\"" ),
1198 EXC_NUMFMT_STRING( 65, "#,##0.00 \"kr\";-#,##0.00 \"kr\"" ),
1199 EXC_NUMFMT_STRING( 66, "#,##0.00 \"kr\";[RED]-#,##0.00 \"kr\"" ),
1200 EXC_NUMFMT_ENDTABLE()
1203 const XclBuiltInFormat spBuiltInFormats_SWEDISH_FINLAND
[] =
1205 EXC_NUMFMT_STRING( 9, "0 %" ),
1206 EXC_NUMFMT_STRING( 10, "0.00 %" ),
1207 EXC_NUMFMT_STRING( 15, "DD.MMM.YY" ),
1208 EXC_NUMFMT_STRING( 16, "DD.MMM" ),
1209 EXC_NUMFMT_STRING( 17, "MMM.YY" ),
1210 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1211 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1212 EXC_NUMFMT_STRING( 22, "D.M.YYYY hh:mm" ),
1213 EXC_NUMFMT_STRING( 37, "#,##0 _" UTF8_EURO
";-#,##0 _" UTF8_EURO
),
1214 EXC_NUMFMT_STRING( 38, "#,##0 _" UTF8_EURO
";[RED]-#,##0 _" UTF8_EURO
),
1215 EXC_NUMFMT_STRING( 39, "#,##0.00 _" UTF8_EURO
";-#,##0.00 _" UTF8_EURO
),
1216 EXC_NUMFMT_STRING( 40, "#,##0.00 _" UTF8_EURO
";[RED]-#,##0.00 _" UTF8_EURO
),
1217 EXC_NUMFMT_STRING( 63, "#,##0 " UTF8_EURO
";-#,##0 " UTF8_EURO
),
1218 EXC_NUMFMT_STRING( 64, "#,##0 " UTF8_EURO
";[RED]-#,##0 " UTF8_EURO
),
1219 EXC_NUMFMT_STRING( 65, "#,##0.00 " UTF8_EURO
";-#,##0.00 " UTF8_EURO
),
1220 EXC_NUMFMT_STRING( 66, "#,##0.00 " UTF8_EURO
";[RED]-#,##0.00 " UTF8_EURO
),
1221 EXC_NUMFMT_ENDTABLE()
1224 // ASIAN ----------------------------------------------------------------------
1226 /** Base table for Asian locales. */
1227 const XclBuiltInFormat spBuiltInFormats_ASIAN
[] =
1229 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1230 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1231 EXC_NUMFMT_STRING( 20, "h:mm" ),
1232 EXC_NUMFMT_STRING( 21, "h:mm:ss" ),
1233 EXC_NUMFMT_STRING( 23, "$#,##0_);($#,##0)" ),
1234 EXC_NUMFMT_STRING( 24, "$#,##0_);[RED]($#,##0)" ),
1235 EXC_NUMFMT_STRING( 25, "$#,##0.00_);($#,##0.00)" ),
1236 EXC_NUMFMT_STRING( 26, "$#,##0.00_);[RED]($#,##0.00)" ),
1237 EXC_NUMFMT_REUSE( 29, 28 ),
1238 EXC_NUMFMT_REUSE( 36, 27 ),
1239 EXC_NUMFMT_REUSE( 50, 27 ),
1240 EXC_NUMFMT_REUSE( 51, 28 ),
1241 EXC_NUMFMT_REUSE( 52, 34 ),
1242 EXC_NUMFMT_REUSE( 53, 35 ),
1243 EXC_NUMFMT_REUSE( 54, 28 ),
1244 EXC_NUMFMT_REUSE( 55, 34 ),
1245 EXC_NUMFMT_REUSE( 56, 35 ),
1246 EXC_NUMFMT_REUSE( 57, 27 ),
1247 EXC_NUMFMT_REUSE( 58, 28 ),
1248 EXC_NUMFMT_ENDTABLE()
1251 const XclBuiltInFormat spBuiltInFormats_JAPANESE
[] =
1253 EXC_NUMFMT_STRING( 14, "YYYY/M/D" ),
1254 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1255 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1256 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1257 EXC_NUMFMT_STRING( 22, "YYYY/M/D h:mm" ),
1258 EXC_NUMFMT_STRING( 27, "[$-0411]GE.M.D" ),
1259 EXC_NUMFMT_STRING( 28, "[$-0411]GGGE" UTF8_CJ_YEAR
"M" UTF8_CJ_MON
"D" UTF8_CJ_DAY
),
1260 EXC_NUMFMT_STRING( 30, "[$-0411]M/D/YY" ),
1261 EXC_NUMFMT_STRING( 31, "[$-0411]YYYY" UTF8_CJ_YEAR
"M" UTF8_CJ_MON
"D" UTF8_CJ_DAY
),
1262 EXC_NUMFMT_STRING( 32, "[$-0411]h" UTF8_CJ_HOUR
"mm" UTF8_CJ_MIN
),
1263 EXC_NUMFMT_STRING( 33, "[$-0411]h" UTF8_CJ_HOUR
"mm" UTF8_CJ_MIN
"ss" UTF8_CJ_SEC
),
1264 EXC_NUMFMT_STRING( 34, "[$-0411]YYYY" UTF8_CJ_YEAR
"M" UTF8_CJ_MON
),
1265 EXC_NUMFMT_STRING( 35, "[$-0411]M" UTF8_CJ_MON
"D" UTF8_CJ_DAY
),
1266 EXC_NUMFMT_STRING( 63, UTF8_YEN_JP
"#,##0;-" UTF8_YEN_JP
"#,##0" ),
1267 EXC_NUMFMT_STRING( 64, UTF8_YEN_JP
"#,##0;[RED]-" UTF8_YEN_JP
"#,##0" ),
1268 EXC_NUMFMT_STRING( 65, UTF8_YEN_JP
"#,##0.00;-" UTF8_YEN_JP
"#,##0.00" ),
1269 EXC_NUMFMT_STRING( 66, UTF8_YEN_JP
"#,##0.00;[RED]-" UTF8_YEN_JP
"#,##0.00" ),
1270 EXC_NUMFMT_ENDTABLE()
1273 const XclBuiltInFormat spBuiltInFormats_KOREAN
[] =
1275 EXC_NUMFMT_STRING( 14, "YYYY-MM-DD" ),
1276 EXC_NUMFMT_STRING( 15, "DD-MMM-YY" ),
1277 EXC_NUMFMT_STRING( 16, "DD-MMM" ),
1278 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1279 EXC_NUMFMT_STRING( 22, "YYYY-MM-DD h:mm" ),
1280 EXC_NUMFMT_STRING( 27, "[$-0412]YYYY" UTF8_CJ_YEAR
" MM" UTF8_CJ_MON
" DD" UTF8_CJ_DAY
),
1281 EXC_NUMFMT_STRING( 28, "[$-0412]MM-DD" ),
1282 EXC_NUMFMT_STRING( 30, "[$-0412]MM-DD-YY" ),
1283 EXC_NUMFMT_STRING( 31, "[$-0412]YYYY" UTF8_KO_YEAR
" MM" UTF8_KO_MON
" DD" UTF8_KO_DAY
),
1284 EXC_NUMFMT_STRING( 32, "[$-0412]h" UTF8_KO_HOUR
" mm" UTF8_KO_MIN
),
1285 EXC_NUMFMT_STRING( 33, "[$-0412]h" UTF8_KO_HOUR
" mm" UTF8_KO_MIN
" ss" UTF8_KO_SEC
),
1286 EXC_NUMFMT_STRING( 34, "[$-0412]YYYY\"/\"MM\"/\"DD" ),
1287 EXC_NUMFMT_STRING( 35, "[$-0412]YYYY-MM-DD" ),
1288 EXC_NUMFMT_STRING( 63, UTF8_WON
"#,##0;-" UTF8_WON
"#,##0" ),
1289 EXC_NUMFMT_STRING( 64, UTF8_WON
"#,##0;[RED]-" UTF8_WON
"#,##0" ),
1290 EXC_NUMFMT_STRING( 65, UTF8_WON
"#,##0.00;-" UTF8_WON
"#,##0.00" ),
1291 EXC_NUMFMT_STRING( 66, UTF8_WON
"#,##0.00;[RED]-" UTF8_WON
"#,##0.00" ),
1292 EXC_NUMFMT_ENDTABLE()
1295 const XclBuiltInFormat spBuiltInFormats_CHINESE_SIMPLIFIED
[] =
1297 EXC_NUMFMT_STRING( 14, "YYYY-M-D" ),
1298 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1299 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1300 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1301 EXC_NUMFMT_STRING( 22, "YYYY-M-D h:mm" ),
1302 EXC_NUMFMT_STRING( 27, "[$-0804]YYYY" UTF8_CJ_YEAR
"M" UTF8_CJ_MON
),
1303 EXC_NUMFMT_STRING( 28, "[$-0804]M" UTF8_CJ_MON
"D" UTF8_CJ_DAY
),
1304 EXC_NUMFMT_STRING( 30, "[$-0804]M-D-YY" ),
1305 EXC_NUMFMT_STRING( 31, "[$-0804]YYYY" UTF8_CJ_YEAR
"M" UTF8_CJ_MON
"D" UTF8_CJ_DAY
),
1306 EXC_NUMFMT_STRING( 32, "[$-0804]h" UTF8_CS_HOUR
"mm" UTF8_CJ_MIN
),
1307 EXC_NUMFMT_STRING( 33, "[$-0804]h" UTF8_CS_HOUR
"mm" UTF8_CJ_MIN
"ss" UTF8_CJ_SEC
),
1308 EXC_NUMFMT_STRING( 34, "[$-0804]AM/PMh" UTF8_CS_HOUR
"mm" UTF8_CJ_MIN
),
1309 EXC_NUMFMT_STRING( 35, "[$-0804]AM/PMh" UTF8_CS_HOUR
"mm" UTF8_CJ_MIN
"ss" UTF8_CJ_SEC
),
1310 EXC_NUMFMT_REUSE( 52, 27 ),
1311 EXC_NUMFMT_REUSE( 53, 28 ),
1312 EXC_NUMFMT_STRING( 63, UTF8_YEN_CS
"#,##0;-" UTF8_YEN_CS
"#,##0" ),
1313 EXC_NUMFMT_STRING( 64, UTF8_YEN_CS
"#,##0;[RED]-" UTF8_YEN_CS
"#,##0" ),
1314 EXC_NUMFMT_STRING( 65, UTF8_YEN_CS
"#,##0.00;-" UTF8_YEN_CS
"#,##0.00" ),
1315 EXC_NUMFMT_STRING( 66, UTF8_YEN_CS
"#,##0.00;[RED]-" UTF8_YEN_CS
"#,##0.00" ),
1316 EXC_NUMFMT_ENDTABLE()
1319 const XclBuiltInFormat spBuiltInFormats_CHINESE_TRADITIONAL
[] =
1321 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1322 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1323 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1324 EXC_NUMFMT_STRING( 18, "hh:mm AM/PM" ),
1325 EXC_NUMFMT_STRING( 19, "hh:mm:ss AM/PM" ),
1326 EXC_NUMFMT_OFFSET( 20, NF_TIME_HHMM
),
1327 EXC_NUMFMT_OFFSET( 21, NF_TIME_HHMMSS
),
1328 EXC_NUMFMT_STRING( 22, "YYYY/M/D hh:mm" ),
1329 EXC_NUMFMT_STRING( 23, "US$#,##0_);(US$#,##0)" ),
1330 EXC_NUMFMT_STRING( 24, "US$#,##0_);[RED](US$#,##0)" ),
1331 EXC_NUMFMT_STRING( 25, "US$#,##0.00_);(US$#,##0.00)" ),
1332 EXC_NUMFMT_STRING( 26, "US$#,##0.00_);[RED](US$#,##0.00)" ),
1333 EXC_NUMFMT_STRING( 27, "[$-0404]E/M/D" ),
1334 EXC_NUMFMT_STRING( 28, "[$-0404]E" UTF8_CJ_YEAR
"M" UTF8_CJ_MON
"D" UTF8_CJ_DAY
),
1335 EXC_NUMFMT_STRING( 30, "[$-0404]M/D/YY" ),
1336 EXC_NUMFMT_STRING( 31, "[$-0404]YYYY" UTF8_CJ_YEAR
"M" UTF8_CJ_MON
"D" UTF8_CJ_DAY
),
1337 EXC_NUMFMT_STRING( 32, "[$-0404]hh" UTF8_CJ_HOUR
"mm" UTF8_CJ_MIN
),
1338 EXC_NUMFMT_STRING( 33, "[$-0404]hh" UTF8_CJ_HOUR
"mm" UTF8_CJ_MIN
"ss" UTF8_CJ_SEC
),
1339 EXC_NUMFMT_STRING( 34, "[$-0404]AM/PMhh" UTF8_CJ_HOUR
"mm" UTF8_CJ_MIN
),
1340 EXC_NUMFMT_STRING( 35, "[$-0404]AM/PMhh" UTF8_CJ_HOUR
"mm" UTF8_CJ_MIN
"ss" UTF8_CJ_SEC
),
1341 EXC_NUMFMT_STRING( 63, "$#,##0;-$#,##0" ),
1342 EXC_NUMFMT_STRING( 64, "$#,##0;[RED]-$#,##0" ),
1343 EXC_NUMFMT_STRING( 65, "$#,##0.00;-$#,##0.00" ),
1344 EXC_NUMFMT_STRING( 66, "$#,##0.00;[RED]-$#,##0.00" ),
1345 EXC_NUMFMT_ENDTABLE()
1348 // OTHER ----------------------------------------------------------------------
1350 const XclBuiltInFormat spBuiltInFormats_HEBREW
[] =
1352 EXC_NUMFMT_STRING( 15, "DD-MMMM-YY" ),
1353 EXC_NUMFMT_STRING( 16, "DD-MMMM" ),
1354 EXC_NUMFMT_STRING( 17, "MMMM-YY" ),
1355 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1356 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1357 EXC_NUMFMT_STRING( 63, UTF8_SHEQEL
" #,##0;" UTF8_SHEQEL
" -#,##0" ),
1358 EXC_NUMFMT_STRING( 64, UTF8_SHEQEL
" #,##0;[RED]" UTF8_SHEQEL
" -#,##0" ),
1359 EXC_NUMFMT_STRING( 65, UTF8_SHEQEL
" #,##0.00;" UTF8_SHEQEL
" -#,##0.00" ),
1360 EXC_NUMFMT_STRING( 66, UTF8_SHEQEL
" #,##0.00;[RED]" UTF8_SHEQEL
" -#,##0.00" ),
1361 EXC_NUMFMT_ENDTABLE()
1364 const XclBuiltInFormat spBuiltInFormats_THAI
[] =
1366 EXC_NUMFMT_STRING( 14, "D/M/YYYY" ),
1367 EXC_NUMFMT_STRING( 15, "D-MMM-YY" ),
1368 EXC_NUMFMT_STRING( 16, "D-MMM" ),
1369 EXC_NUMFMT_STRING( 17, "MMM-YY" ),
1370 EXC_NUMFMT_STRING( 18, "h:mm AM/PM" ),
1371 EXC_NUMFMT_STRING( 19, "h:mm:ss AM/PM" ),
1372 EXC_NUMFMT_STRING( 22, "D/M/YYYY h:mm" ),
1373 EXC_NUMFMT_STRING( 59, "t0" ),
1374 EXC_NUMFMT_STRING( 60, "t0.00" ),
1375 EXC_NUMFMT_STRING( 61, "t#,##0" ),
1376 EXC_NUMFMT_STRING( 62, "t#,##0.00" ),
1377 EXC_NUMFMT_STRING( 63, "t" UTF8_BAHT
"#,##0_);t(" UTF8_BAHT
"#,##0)" ),
1378 EXC_NUMFMT_STRING( 64, "t" UTF8_BAHT
"#,##0_);[RED]t(" UTF8_BAHT
"#,##0)" ),
1379 EXC_NUMFMT_STRING( 65, "t" UTF8_BAHT
"#,##0.00_);t(" UTF8_BAHT
"#,##0.00)" ),
1380 EXC_NUMFMT_STRING( 66, "t" UTF8_BAHT
"#,##0.00_);[RED]t(" UTF8_BAHT
"#,##0.00)" ),
1381 EXC_NUMFMT_STRING( 67, "t0%" ),
1382 EXC_NUMFMT_STRING( 68, "t0.00%" ),
1383 EXC_NUMFMT_STRING( 69, "t# ?/?" ),
1384 EXC_NUMFMT_STRING( 70, "t# ?\?/?\?" ),
1385 EXC_NUMFMT_STRING( 71, "tD/M/EE" ),
1386 EXC_NUMFMT_STRING( 72, "tD-MMM-E" ),
1387 EXC_NUMFMT_STRING( 73, "tD-MMM" ),
1388 EXC_NUMFMT_STRING( 74, "tMMM-E" ),
1389 EXC_NUMFMT_STRING( 75, "th:mm" ),
1390 EXC_NUMFMT_STRING( 76, "th:mm:ss" ),
1391 EXC_NUMFMT_STRING( 77, "tD/M/EE h:mm" ),
1392 EXC_NUMFMT_STRING( 78, "tmm:ss" ),
1393 EXC_NUMFMT_STRING( 79, "t[h]:mm:ss" ),
1394 EXC_NUMFMT_STRING( 80, "tmm:ss.0" ),
1395 EXC_NUMFMT_STRING( 81, "D/M/E" ),
1396 EXC_NUMFMT_ENDTABLE()
1399 #undef EXC_NUMFMT_ENDTABLE
1400 #undef EXC_NUMFMT_REUSE
1401 #undef EXC_NUMFMT_OFFSET
1402 #undef EXC_NUMFMT_STRING
1404 /** Specifies a number format table for a specific language. */
1405 struct XclBuiltInFormatTable
1407 LanguageType meLanguage
; /// The language of this table.
1408 LanguageType meParentLang
; /// The language of the parent table.
1409 const XclBuiltInFormat
* mpFormats
; /// The number format table.
1412 const XclBuiltInFormatTable spBuiltInFormatTables
[] =
1413 { // language parent language format table
1414 { LANGUAGE_DONTKNOW
, LANGUAGE_NONE
, spBuiltInFormats_DONTKNOW
},
1416 { LANGUAGE_ENGLISH
, LANGUAGE_DONTKNOW
, spBuiltInFormats_ENGLISH
},
1417 { LANGUAGE_ENGLISH_UK
, LANGUAGE_ENGLISH
, spBuiltInFormats_ENGLISH_UK
},
1418 { LANGUAGE_ENGLISH_EIRE
, LANGUAGE_ENGLISH
, spBuiltInFormats_ENGLISH_EIRE
},
1419 { LANGUAGE_ENGLISH_US
, LANGUAGE_ENGLISH
, spBuiltInFormats_ENGLISH_US
},
1420 { LANGUAGE_ENGLISH_CAN
, LANGUAGE_ENGLISH
, spBuiltInFormats_ENGLISH_CAN
},
1421 { LANGUAGE_ENGLISH_AUS
, LANGUAGE_ENGLISH
, spBuiltInFormats_ENGLISH_AUS
},
1422 { LANGUAGE_ENGLISH_SAFRICA
, LANGUAGE_ENGLISH
, spBuiltInFormats_ENGLISH_SAFRICA
},
1423 { LANGUAGE_ENGLISH_NZ
, LANGUAGE_ENGLISH_AUS
, nullptr },
1425 { PRV_LANGUAGE_FRENCH_PRIM
, LANGUAGE_DONTKNOW
, spBuiltInFormats_FRENCH
},
1426 { LANGUAGE_FRENCH
, PRV_LANGUAGE_FRENCH_PRIM
, spBuiltInFormats_FRENCH_FRANCE
},
1427 { LANGUAGE_FRENCH_CANADIAN
, PRV_LANGUAGE_FRENCH_PRIM
, spBuiltInFormats_FRENCH_CANADIAN
},
1428 { LANGUAGE_FRENCH_SWISS
, PRV_LANGUAGE_FRENCH_PRIM
, spBuiltInFormats_FRENCH_SWISS
},
1429 { LANGUAGE_FRENCH_BELGIAN
, LANGUAGE_FRENCH
, spBuiltInFormats_FRENCH_BELGIAN
},
1430 { LANGUAGE_FRENCH_LUXEMBOURG
, LANGUAGE_FRENCH
, nullptr },
1431 { LANGUAGE_FRENCH_MONACO
, LANGUAGE_FRENCH
, nullptr },
1433 { PRV_LANGUAGE_GERMAN_PRIM
, LANGUAGE_DONTKNOW
, spBuiltInFormats_GERMAN
},
1434 { LANGUAGE_GERMAN
, PRV_LANGUAGE_GERMAN_PRIM
, spBuiltInFormats_GERMAN_GERMANY
},
1435 { LANGUAGE_GERMAN_AUSTRIAN
, PRV_LANGUAGE_GERMAN_PRIM
, spBuiltInFormats_GERMAN_AUSTRIAN
},
1436 { LANGUAGE_GERMAN_SWISS
, PRV_LANGUAGE_GERMAN_PRIM
, spBuiltInFormats_GERMAN_SWISS
},
1437 { LANGUAGE_GERMAN_LUXEMBOURG
, PRV_LANGUAGE_GERMAN_PRIM
, spBuiltInFormats_GERMAN_LUXEMBOURG
},
1438 { LANGUAGE_GERMAN_LIECHTENSTEIN
, PRV_LANGUAGE_GERMAN_PRIM
, spBuiltInFormats_GERMAN_LIECHTENSTEIN
},
1440 { LANGUAGE_ITALIAN
, LANGUAGE_DONTKNOW
, spBuiltInFormats_ITALIAN_ITALY
},
1441 { LANGUAGE_ITALIAN_SWISS
, LANGUAGE_DONTKNOW
, spBuiltInFormats_ITALIAN_SWISS
},
1443 { LANGUAGE_SWEDISH
, LANGUAGE_DONTKNOW
, spBuiltInFormats_SWEDISH_SWEDEN
},
1444 { LANGUAGE_SWEDISH_FINLAND
, LANGUAGE_DONTKNOW
, spBuiltInFormats_SWEDISH_FINLAND
},
1446 { PRV_LANGUAGE_ASIAN_PRIM
, LANGUAGE_DONTKNOW
, spBuiltInFormats_ASIAN
},
1447 { LANGUAGE_JAPANESE
, PRV_LANGUAGE_ASIAN_PRIM
, spBuiltInFormats_JAPANESE
},
1448 { LANGUAGE_KOREAN
, PRV_LANGUAGE_ASIAN_PRIM
, spBuiltInFormats_KOREAN
},
1449 { LANGUAGE_CHINESE_SIMPLIFIED
, PRV_LANGUAGE_ASIAN_PRIM
, spBuiltInFormats_CHINESE_SIMPLIFIED
},
1450 { LANGUAGE_CHINESE_TRADITIONAL
, PRV_LANGUAGE_ASIAN_PRIM
, spBuiltInFormats_CHINESE_TRADITIONAL
},
1452 { LANGUAGE_HEBREW
, LANGUAGE_DONTKNOW
, spBuiltInFormats_HEBREW
},
1453 { LANGUAGE_THAI
, LANGUAGE_DONTKNOW
, spBuiltInFormats_THAI
}
1458 XclNumFmtBuffer::XclNumFmtBuffer( const XclRoot
& rRoot
) :
1459 meSysLang( rRoot
.GetSysLanguage() ),
1460 mnStdScNumFmt( rRoot
.GetFormatter().GetStandardIndex( ScGlobal::eLnge
) )
1462 // *** insert default formats (BIFF5+ only)***
1464 if( rRoot
.GetBiff() >= EXC_BIFF5
)
1465 InsertBuiltinFormats();
1468 void XclNumFmtBuffer::InitializeImport()
1473 void XclNumFmtBuffer::InsertFormat( sal_uInt16 nXclNumFmt
, const OUString
& rFormat
)
1475 XclNumFmt
& rNumFmt
= maFmtMap
[ nXclNumFmt
];
1476 rNumFmt
.maFormat
= rFormat
;
1477 // #i62053# rFormat may be an empty string, meOffset must be initialized
1478 rNumFmt
.meOffset
= NF_NUMBER_STANDARD
;
1479 rNumFmt
.meLanguage
= LANGUAGE_SYSTEM
;
1482 void XclNumFmtBuffer::InsertBuiltinFormats()
1484 // build a map containing tables for all languages
1485 typedef ::std::map
< LanguageType
, const XclBuiltInFormatTable
* > XclBuiltInMap
;
1486 XclBuiltInMap aBuiltInMap
;
1487 for(const auto &rTable
: spBuiltInFormatTables
)
1488 aBuiltInMap
[ rTable
.meLanguage
] = &rTable
;
1490 // build a list of table pointers for the current language, with all parent tables
1491 typedef ::std::vector
< const XclBuiltInFormatTable
* > XclBuiltInVec
;
1492 XclBuiltInVec aBuiltInVec
;
1493 for( XclBuiltInMap::const_iterator aMIt
= aBuiltInMap
.find( meSysLang
), aMEnd
= aBuiltInMap
.end();
1494 aMIt
!= aMEnd
; aMIt
= aBuiltInMap
.find( aMIt
->second
->meParentLang
) )
1495 aBuiltInVec
.push_back( aMIt
->second
);
1496 // language not supported
1497 if( aBuiltInVec
.empty() )
1499 SAL_WARN("sc", "XclNumFmtBuffer::InsertBuiltinFormats - language not supported (#i29949#) 0x" << std::hex
<< meSysLang
);
1500 XclBuiltInMap::const_iterator aMIt
= aBuiltInMap
.find( LANGUAGE_DONTKNOW
);
1501 OSL_ENSURE( aMIt
!= aBuiltInMap
.end(), "XclNumFmtBuffer::InsertBuiltinFormats - default map not found" );
1502 if( aMIt
!= aBuiltInMap
.end() )
1503 aBuiltInVec
.push_back( aMIt
->second
);
1506 // insert the default formats in the format map, from root parent to system language
1507 std::map
< sal_uInt16
, sal_uInt16
> aReuseMap
;
1508 for( XclBuiltInVec::reverse_iterator aVIt
= aBuiltInVec
.rbegin(), aVEnd
= aBuiltInVec
.rend(); aVIt
!= aVEnd
; ++aVIt
)
1510 // put LANGUAGE_SYSTEM for all entries in default table
1511 LanguageType eLang
= ((*aVIt
)->meLanguage
== LANGUAGE_DONTKNOW
) ? LANGUAGE_SYSTEM
: meSysLang
;
1512 for( const XclBuiltInFormat
* pBuiltIn
= (*aVIt
)->mpFormats
; pBuiltIn
&& (pBuiltIn
->mnXclNumFmt
!= EXC_FORMAT_NOTFOUND
); ++pBuiltIn
)
1514 XclNumFmt
& rNumFmt
= maFmtMap
[ pBuiltIn
->mnXclNumFmt
];
1516 rNumFmt
.meOffset
= pBuiltIn
->meOffset
;
1517 rNumFmt
.meLanguage
= eLang
;
1519 if( pBuiltIn
->mpFormat
)
1520 rNumFmt
.maFormat
= OUString( pBuiltIn
->mpFormat
, strlen(pBuiltIn
->mpFormat
), RTL_TEXTENCODING_UTF8
);
1522 rNumFmt
.maFormat
.clear();
1524 if( pBuiltIn
->meOffset
== PRV_NF_INDEX_REUSE
)
1525 aReuseMap
[ pBuiltIn
->mnXclNumFmt
] = pBuiltIn
->mnXclReuseFmt
;
1527 aReuseMap
.erase( pBuiltIn
->mnXclNumFmt
);
1531 // copy reused number formats
1532 for( const auto& [rXclNumFmt
, rXclReuseFmt
] : aReuseMap
)
1533 maFmtMap
[ rXclNumFmt
] = maFmtMap
[ rXclReuseFmt
];
1536 // Cell formatting data (XF) ==================================================
1538 XclCellProt::XclCellProt() :
1539 mbLocked( true ), // default in Excel and Calc
1544 bool operator==( const XclCellProt
& rLeft
, const XclCellProt
& rRight
)
1546 return (rLeft
.mbLocked
== rRight
.mbLocked
) && (rLeft
.mbHidden
== rRight
.mbHidden
);
1549 XclCellAlign::XclCellAlign() :
1550 mnHorAlign( EXC_XF_HOR_GENERAL
),
1551 mnVerAlign( EXC_XF_VER_BOTTOM
),
1552 mnOrient( EXC_ORIENT_NONE
),
1553 mnTextDir( EXC_XF_TEXTDIR_CONTEXT
),
1554 mnRotation( EXC_ROT_NONE
),
1556 mbLineBreak( false ),
1561 SvxCellHorJustify
XclCellAlign::GetScHorAlign() const
1563 SvxCellHorJustify eHorJust
= SvxCellHorJustify::Standard
;
1564 switch( mnHorAlign
)
1566 case EXC_XF_HOR_GENERAL
: eHorJust
= SvxCellHorJustify::Standard
; break;
1567 case EXC_XF_HOR_LEFT
: eHorJust
= SvxCellHorJustify::Left
; break;
1568 case EXC_XF_HOR_CENTER_AS
:
1569 case EXC_XF_HOR_CENTER
: eHorJust
= SvxCellHorJustify::Center
; break;
1570 case EXC_XF_HOR_RIGHT
: eHorJust
= SvxCellHorJustify::Right
; break;
1571 case EXC_XF_HOR_FILL
: eHorJust
= SvxCellHorJustify::Repeat
; break;
1572 case EXC_XF_HOR_JUSTIFY
:
1573 case EXC_XF_HOR_DISTRIB
: eHorJust
= SvxCellHorJustify::Block
; break;
1574 default: OSL_FAIL( "XclCellAlign::GetScHorAlign - unknown horizontal alignment" );
1579 SvxCellJustifyMethod
XclCellAlign::GetScHorJustifyMethod() const
1581 return (mnHorAlign
== EXC_XF_HOR_DISTRIB
) ? SvxCellJustifyMethod::Distribute
: SvxCellJustifyMethod::Auto
;
1584 SvxCellVerJustify
XclCellAlign::GetScVerAlign() const
1586 SvxCellVerJustify eVerJust
= SvxCellVerJustify::Standard
;
1587 switch( mnVerAlign
)
1589 case EXC_XF_VER_TOP
: eVerJust
= SvxCellVerJustify::Top
; break;
1590 case EXC_XF_VER_CENTER
: eVerJust
= SvxCellVerJustify::Center
; break;
1591 case EXC_XF_VER_BOTTOM
: eVerJust
= SvxCellVerJustify::Standard
; break;
1592 case EXC_XF_VER_JUSTIFY
:
1593 case EXC_XF_VER_DISTRIB
: eVerJust
= SvxCellVerJustify::Block
; break;
1594 default: OSL_FAIL( "XclCellAlign::GetScVerAlign - unknown vertical alignment" );
1599 SvxCellJustifyMethod
XclCellAlign::GetScVerJustifyMethod() const
1601 return (mnVerAlign
== EXC_XF_VER_DISTRIB
) ? SvxCellJustifyMethod::Distribute
: SvxCellJustifyMethod::Auto
;
1604 SvxFrameDirection
XclCellAlign::GetScFrameDir() const
1606 SvxFrameDirection eFrameDir
= SvxFrameDirection::Environment
;
1609 case EXC_XF_TEXTDIR_CONTEXT
: eFrameDir
= SvxFrameDirection::Environment
; break;
1610 case EXC_XF_TEXTDIR_LTR
: eFrameDir
= SvxFrameDirection::Horizontal_LR_TB
; break;
1611 case EXC_XF_TEXTDIR_RTL
: eFrameDir
= SvxFrameDirection::Horizontal_RL_TB
; break;
1612 default: OSL_FAIL( "XclCellAlign::GetScFrameDir - unknown CTL text direction" );
1617 void XclCellAlign::SetScHorAlign( SvxCellHorJustify eHorJust
)
1621 case SvxCellHorJustify::Standard
: mnHorAlign
= EXC_XF_HOR_GENERAL
; break;
1622 case SvxCellHorJustify::Left
: mnHorAlign
= EXC_XF_HOR_LEFT
; break;
1623 case SvxCellHorJustify::Center
: mnHorAlign
= EXC_XF_HOR_CENTER
; break;
1624 case SvxCellHorJustify::Right
: mnHorAlign
= EXC_XF_HOR_RIGHT
; break;
1625 case SvxCellHorJustify::Block
: mnHorAlign
= EXC_XF_HOR_JUSTIFY
; break;
1626 case SvxCellHorJustify::Repeat
: mnHorAlign
= EXC_XF_HOR_FILL
; break;
1627 default: mnHorAlign
= EXC_XF_HOR_GENERAL
;
1628 OSL_FAIL( "XclCellAlign::SetScHorAlign - unknown horizontal alignment" );
1632 void XclCellAlign::SetScVerAlign( SvxCellVerJustify eVerJust
)
1636 case SvxCellVerJustify::Standard
: mnVerAlign
= EXC_XF_VER_BOTTOM
; break;
1637 case SvxCellVerJustify::Top
: mnVerAlign
= EXC_XF_VER_TOP
; break;
1638 case SvxCellVerJustify::Center
: mnVerAlign
= EXC_XF_VER_CENTER
; break;
1639 case SvxCellVerJustify::Bottom
: mnVerAlign
= EXC_XF_VER_BOTTOM
; break;
1640 default: mnVerAlign
= EXC_XF_VER_BOTTOM
;
1641 OSL_FAIL( "XclCellAlign::SetScVerAlign - unknown vertical alignment" );
1645 void XclCellAlign::SetScFrameDir( SvxFrameDirection eFrameDir
)
1649 case SvxFrameDirection::Environment
: mnTextDir
= EXC_XF_TEXTDIR_CONTEXT
; break;
1650 case SvxFrameDirection::Horizontal_LR_TB
: mnTextDir
= EXC_XF_TEXTDIR_LTR
; break;
1651 case SvxFrameDirection::Horizontal_RL_TB
: mnTextDir
= EXC_XF_TEXTDIR_RTL
; break;
1652 default: mnTextDir
= EXC_XF_TEXTDIR_CONTEXT
;
1653 OSL_FAIL( "XclCellAlign::SetScFrameDir - unknown CTL text direction" );
1657 bool operator==( const XclCellAlign
& rLeft
, const XclCellAlign
& rRight
)
1660 (rLeft
.mnHorAlign
== rRight
.mnHorAlign
) && (rLeft
.mnVerAlign
== rRight
.mnVerAlign
) &&
1661 (rLeft
.mnTextDir
== rRight
.mnTextDir
) && (rLeft
.mnOrient
== rRight
.mnOrient
) &&
1662 (rLeft
.mnRotation
== rRight
.mnRotation
) && (rLeft
.mnIndent
== rRight
.mnIndent
) &&
1663 (rLeft
.mbLineBreak
== rRight
.mbLineBreak
) && (rLeft
.mbShrink
== rRight
.mbShrink
);
1666 XclCellBorder::XclCellBorder() :
1672 mnLeftLine( EXC_LINE_NONE
),
1673 mnRightLine( EXC_LINE_NONE
),
1674 mnTopLine( EXC_LINE_NONE
),
1675 mnBottomLine( EXC_LINE_NONE
),
1676 mnDiagLine( EXC_LINE_NONE
),
1677 mbDiagTLtoBR( false ),
1678 mbDiagBLtoTR( false )
1682 bool operator==( const XclCellBorder
& rLeft
, const XclCellBorder
& rRight
)
1685 (rLeft
.mnLeftColor
== rRight
.mnLeftColor
) && (rLeft
.mnRightColor
== rRight
.mnRightColor
) &&
1686 (rLeft
.mnTopColor
== rRight
.mnTopColor
) && (rLeft
.mnBottomColor
== rRight
.mnBottomColor
) &&
1687 (rLeft
.mnLeftLine
== rRight
.mnLeftLine
) && (rLeft
.mnRightLine
== rRight
.mnRightLine
) &&
1688 (rLeft
.mnTopLine
== rRight
.mnTopLine
) && (rLeft
.mnBottomLine
== rRight
.mnBottomLine
) &&
1689 (rLeft
.mnDiagColor
== rRight
.mnDiagColor
) && (rLeft
.mnDiagLine
== rRight
.mnDiagLine
) &&
1690 (rLeft
.mbDiagTLtoBR
== rRight
.mbDiagTLtoBR
) && (rLeft
.mbDiagBLtoTR
== rRight
.mbDiagBLtoTR
);
1693 XclCellArea::XclCellArea() :
1694 mnForeColor( EXC_COLOR_WINDOWTEXT
),
1695 mnBackColor( EXC_COLOR_WINDOWBACK
),
1696 mnPattern( EXC_PATT_NONE
)
1700 XclCellArea::XclCellArea(sal_uInt8 nPattern
) :
1701 mnForeColor( EXC_COLOR_WINDOWTEXT
),
1702 mnBackColor( EXC_COLOR_WINDOWBACK
),
1703 mnPattern( nPattern
)
1707 bool XclCellArea::IsTransparent() const
1709 return (mnPattern
== EXC_PATT_NONE
) && (mnBackColor
== EXC_COLOR_WINDOWBACK
);
1712 bool operator==( const XclCellArea
& rLeft
, const XclCellArea
& rRight
)
1715 (rLeft
.mnForeColor
== rRight
.mnForeColor
) && (rLeft
.mnBackColor
== rRight
.mnBackColor
) &&
1716 (rLeft
.mnPattern
== rRight
.mnPattern
);
1719 XclXFBase::XclXFBase( bool bCellXF
) :
1720 mnParent( bCellXF
? EXC_XF_DEFAULTSTYLE
: EXC_XF_STYLEPARENT
),
1723 SetAllUsedFlags( false );
1726 XclXFBase::~XclXFBase()
1730 void XclXFBase::SetAllUsedFlags( bool bUsed
)
1732 mbProtUsed
= mbFontUsed
= mbFmtUsed
= mbAlignUsed
= mbBorderUsed
= mbAreaUsed
= bUsed
;
1735 bool XclXFBase::HasUsedFlags() const
1737 return mbProtUsed
|| mbFontUsed
|| mbFmtUsed
|| mbAlignUsed
|| mbBorderUsed
|| mbAreaUsed
;
1740 bool XclXFBase::Equals( const XclXFBase
& rCmp
) const
1743 (mbCellXF
== rCmp
.mbCellXF
) && (mnParent
== rCmp
.mnParent
) &&
1744 (mbProtUsed
== rCmp
.mbProtUsed
) && (mbFontUsed
== rCmp
.mbFontUsed
) &&
1745 (mbFmtUsed
== rCmp
.mbFmtUsed
) && (mbAlignUsed
== rCmp
.mbAlignUsed
) &&
1746 (mbBorderUsed
== rCmp
.mbBorderUsed
) && (mbAreaUsed
== rCmp
.mbAreaUsed
);
1749 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */