Update git submodules
[LibreOffice.git] / xmloff / source / draw / XMLNumberStyles.cxx
blob5c5a0e63c584e30e638276da32b248ec3fe5c53c
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include "XMLNumberStylesExport.hxx"
21 #include <XMLNumberStylesImport.hxx>
22 #include <utility>
23 #include <xmloff/xmlnamespace.hxx>
24 #include <xmloff/xmlimp.hxx>
25 #include <xmloff/xmltoken.hxx>
27 #include <o3tl/string_view.hxx>
28 #include <sal/log.hxx>
30 #include "sdxmlexp_impl.hxx"
31 #include "sdxmlimp_impl.hxx"
33 using namespace ::xmloff::token;
35 namespace {
37 struct SdXMLDataStyleNumber
39 enum XMLTokenEnum meNumberStyle;
40 bool mbLong;
41 bool mbTextual;
42 bool mbDecimal02;
43 OUString maText;
48 SdXMLDataStyleNumber constexpr aSdXMLDataStyleNumbers[] =
50 { XML_DAY, false, false, false, u""_ustr },
51 { XML_DAY, true, false, false, u""_ustr },
52 { XML_MONTH, true, false, false, u""_ustr },
53 { XML_MONTH, false, true, false, u""_ustr },
54 { XML_MONTH, true, true, false, u""_ustr },
55 { XML_YEAR, false, false, false, u""_ustr },
56 { XML_YEAR, true, false, false, u""_ustr },
57 { XML_DAY_OF_WEEK, false, false, false, u""_ustr },
58 { XML_DAY_OF_WEEK, true, false, false, u""_ustr },
59 { XML_TEXT, false, false, false, u"."_ustr },
60 { XML_TEXT, false, false, false, u" "_ustr },
61 { XML_TEXT, false, false, false, u", "_ustr },
62 { XML_TEXT, false, false, false, u". "_ustr },
63 { XML_HOURS, false, false, false, u""_ustr },
64 { XML_MINUTES, false, false, false, u""_ustr },
65 { XML_TEXT, false, false, false, u":"_ustr },
66 { XML_AM_PM, false, false, false, u""_ustr },
67 { XML_SECONDS, false, false, false, u""_ustr },
68 { XML_SECONDS, false, false, true, u""_ustr },
69 { XML_TOKEN_INVALID, false, false, false, u""_ustr }
72 // date
73 enum class DataStyleNumber : sal_uInt8
75 NONE = 0,
76 Day = 1, // <number:day/>
77 DayLong = 2, // <number:day number:style="long"/>
78 MonthLong = 3, // <number:month number:style="long"/>
79 MonthText = 4, // <number:month number:textual="true"/>
80 MonthLongText = 5, // <number:month number:style="long" number:textual="true"/>
81 Year = 6, // <number:year/>
82 YearLong = 7, // <number:year number:style="long"/>
83 DayOfWeek = 8, // <number:day-of-week/>
84 DayOfWeekLong = 9, // <number:day-of-week number:style="long"/>
85 TextPoint = 10, // <number:text>.</number:text>
86 TextSpace = 11, // <number:text> </number:text>
87 TextCommaSpace = 12, // <number:text>, </number:text>
88 TextPointSpace = 13, // <number:text>. </number:text>
89 Hours = 14, // <number:hours/>
90 Minutes = 15, // <number:minutes/>
91 TextColon = 16, // <number:text>:</number:text>
92 AmPm = 17, // <number:am-pm/>
93 Seconds = 18, // <number:seconds/>
94 Seconds_02 = 19, // <number:seconds number:/>
97 struct SdXMLFixedDataStyle
99 OUString maName;
100 bool mbAutomatic;
101 bool mbDateStyle;
102 DataStyleNumber mpFormat[8];
105 constexpr SdXMLFixedDataStyle aSdXML_Standard_Short =
107 u"D1"_ustr, true, true,
109 DataStyleNumber::DayLong,
110 DataStyleNumber::TextPoint,
111 DataStyleNumber::MonthLong,
112 DataStyleNumber::TextPoint,
113 DataStyleNumber::YearLong,
114 DataStyleNumber::NONE, DataStyleNumber::NONE, DataStyleNumber::NONE
118 constexpr SdXMLFixedDataStyle aSdXML_Standard_Long =
120 u"D2"_ustr, true, true,
122 DataStyleNumber::DayOfWeekLong,
123 DataStyleNumber::TextCommaSpace,
124 DataStyleNumber::Day,
125 DataStyleNumber::TextPointSpace,
126 DataStyleNumber::MonthLongText,
127 DataStyleNumber::TextSpace,
128 DataStyleNumber::YearLong,
129 DataStyleNumber::NONE
133 constexpr SdXMLFixedDataStyle aSdXML_DateStyle_1 =
135 u"D3"_ustr, false, true,
137 DataStyleNumber::DayLong,
138 DataStyleNumber::TextPoint,
139 DataStyleNumber::MonthLong,
140 DataStyleNumber::TextPoint,
141 DataStyleNumber::Year,
142 DataStyleNumber::NONE, DataStyleNumber::NONE, DataStyleNumber::NONE
146 constexpr SdXMLFixedDataStyle aSdXML_DateStyle_2 =
148 u"D4"_ustr, false, true,
150 DataStyleNumber::DayLong,
151 DataStyleNumber::TextPoint,
152 DataStyleNumber::MonthLong,
153 DataStyleNumber::TextPoint,
154 DataStyleNumber::YearLong,
155 DataStyleNumber::NONE, DataStyleNumber::NONE, DataStyleNumber::NONE
159 constexpr SdXMLFixedDataStyle aSdXML_DateStyle_3 =
161 u"D5"_ustr, false, true,
163 DataStyleNumber::Day,
164 DataStyleNumber::TextPointSpace,
165 DataStyleNumber::MonthText,
166 DataStyleNumber::TextSpace,
167 DataStyleNumber::YearLong,
168 DataStyleNumber::NONE, DataStyleNumber::NONE, DataStyleNumber::NONE
172 constexpr SdXMLFixedDataStyle aSdXML_DateStyle_4 =
174 u"D6"_ustr, false, true,
176 DataStyleNumber::Day,
177 DataStyleNumber::TextPointSpace,
178 DataStyleNumber::MonthLongText,
179 DataStyleNumber::TextSpace,
180 DataStyleNumber::YearLong,
181 DataStyleNumber::NONE, DataStyleNumber::NONE, DataStyleNumber::NONE
185 constexpr SdXMLFixedDataStyle aSdXML_DateStyle_5 =
187 u"D7"_ustr, false, true,
189 DataStyleNumber::DayOfWeek,
190 DataStyleNumber::TextCommaSpace,
191 DataStyleNumber::Day,
192 DataStyleNumber::TextPointSpace,
193 DataStyleNumber::MonthLongText,
194 DataStyleNumber::TextSpace,
195 DataStyleNumber::YearLong,
196 DataStyleNumber::NONE
200 constexpr SdXMLFixedDataStyle aSdXML_DateStyle_6 =
202 u"D8"_ustr, false, true,
204 DataStyleNumber::DayOfWeekLong,
205 DataStyleNumber::TextCommaSpace,
206 DataStyleNumber::Day,
207 DataStyleNumber::TextPointSpace,
208 DataStyleNumber::MonthLongText,
209 DataStyleNumber::TextSpace,
210 DataStyleNumber::YearLong,
211 DataStyleNumber::NONE
215 constexpr SdXMLFixedDataStyle aSdXML_TimeStyle_1 =
216 { u"T1"_ustr, true, false,
218 DataStyleNumber::Hours,
219 DataStyleNumber::TextColon,
220 DataStyleNumber::Minutes,
221 DataStyleNumber::TextColon,
222 DataStyleNumber::Seconds,
223 DataStyleNumber::AmPm,
224 DataStyleNumber::NONE, DataStyleNumber::NONE
228 constexpr SdXMLFixedDataStyle aSdXML_TimeStyle_2 =
229 { u"T2"_ustr, false, false,
231 DataStyleNumber::Hours,
232 DataStyleNumber::TextColon,
233 DataStyleNumber::Minutes,
234 DataStyleNumber::NONE, DataStyleNumber::NONE, DataStyleNumber::NONE, DataStyleNumber::NONE, DataStyleNumber::NONE
238 constexpr SdXMLFixedDataStyle aSdXML_TimeStyle_3 =
239 { u"T3"_ustr, false, false,
241 DataStyleNumber::Hours,
242 DataStyleNumber::TextColon,
243 DataStyleNumber::Minutes,
244 DataStyleNumber::TextColon,
245 DataStyleNumber::Seconds,
246 DataStyleNumber::NONE, DataStyleNumber::NONE, DataStyleNumber::NONE
250 constexpr SdXMLFixedDataStyle aSdXML_TimeStyle_4 =
251 { u"T4"_ustr, false, false,
253 DataStyleNumber::Hours,
254 DataStyleNumber::TextColon,
255 DataStyleNumber::Minutes,
256 DataStyleNumber::TextColon,
257 DataStyleNumber::Seconds_02,
258 DataStyleNumber::NONE, DataStyleNumber::NONE, DataStyleNumber::NONE
262 constexpr SdXMLFixedDataStyle aSdXML_TimeStyle_5 =
263 { u"T5"_ustr, false, false,
265 DataStyleNumber::Hours,
266 DataStyleNumber::TextColon,
267 DataStyleNumber::Minutes,
268 DataStyleNumber::AmPm,
269 DataStyleNumber::NONE, DataStyleNumber::NONE, DataStyleNumber::NONE, DataStyleNumber::NONE
273 constexpr SdXMLFixedDataStyle aSdXML_TimeStyle_6 =
274 { u"T6"_ustr, false, false,
276 DataStyleNumber::Hours,
277 DataStyleNumber::TextColon,
278 DataStyleNumber::Minutes,
279 DataStyleNumber::TextColon,
280 DataStyleNumber::Seconds,
281 DataStyleNumber::AmPm,
282 DataStyleNumber::NONE, DataStyleNumber::NONE
286 constexpr SdXMLFixedDataStyle aSdXML_TimeStyle_7 =
287 { u"T7"_ustr, false, false,
289 DataStyleNumber::Hours,
290 DataStyleNumber::TextColon,
291 DataStyleNumber::Minutes,
292 DataStyleNumber::TextColon,
293 DataStyleNumber::Seconds_02,
294 DataStyleNumber::AmPm,
295 DataStyleNumber::NONE, DataStyleNumber::NONE
299 const SdXMLFixedDataStyle* const aSdXMLFixedDateFormats[SdXMLDateFormatCount] =
301 &aSdXML_Standard_Short,
302 &aSdXML_Standard_Long,
303 &aSdXML_DateStyle_1,
304 &aSdXML_DateStyle_2,
305 &aSdXML_DateStyle_3,
306 &aSdXML_DateStyle_4,
307 &aSdXML_DateStyle_5,
308 &aSdXML_DateStyle_6,
311 const SdXMLFixedDataStyle* const aSdXMLFixedTimeFormats[SdXMLTimeFormatCount] =
313 &aSdXML_TimeStyle_1,
314 &aSdXML_TimeStyle_2,
315 &aSdXML_TimeStyle_3,
316 &aSdXML_TimeStyle_4,
317 &aSdXML_TimeStyle_5,
318 &aSdXML_TimeStyle_6,
319 &aSdXML_TimeStyle_7
322 // export
324 static void SdXMLExportDataStyleNumber( SdXMLExport& rExport, SdXMLDataStyleNumber const & rElement )
326 if( rElement.mbDecimal02 )
328 rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_DECIMAL_PLACES, XML_2 );
331 if( rElement.mbLong )
333 rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_STYLE, XML_LONG );
336 if( rElement.mbTextual )
338 rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TEXTUAL, XML_TRUE );
341 SvXMLElementExport aNumberStyle( rExport, XML_NAMESPACE_NUMBER, rElement.meNumberStyle, true, false );
342 if( !rElement.maText.isEmpty() )
344 rExport.GetDocHandler()->characters( rElement.maText );
348 static void SdXMLExportStyle( SdXMLExport& rExport, const SdXMLFixedDataStyle* pStyle, const SdXMLFixedDataStyle* pStyle2 = nullptr )
350 // name
351 OUString sAttrValue = pStyle->maName;
352 if( pStyle2 )
353 sAttrValue += pStyle2->maName;
355 rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_NAME, sAttrValue );
357 if( pStyle->mbAutomatic )
359 rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_AUTOMATIC_ORDER, XML_TRUE );
362 SvXMLElementExport aElement( rExport, XML_NAMESPACE_NUMBER, pStyle->mbDateStyle ? XML_DATE_STYLE : XML_TIME_STYLE, true, true );
367 const DataStyleNumber* pElements = &pStyle->mpFormat[0];
369 while( *pElements != DataStyleNumber::NONE )
371 SdXMLDataStyleNumber const & rElement = aSdXMLDataStyleNumbers[ static_cast<int>(*pElements++) - 1 ];
372 SdXMLExportDataStyleNumber( rExport, rElement );
375 if( pStyle2 )
377 SdXMLDataStyleNumber const & rElement = aSdXMLDataStyleNumbers[ static_cast<int>(DataStyleNumber::TextSpace) - 1 ];
378 SdXMLExportDataStyleNumber( rExport, rElement );
381 pStyle = pStyle2;
382 pStyle2 = nullptr;
384 while( pStyle );
387 void SdXMLNumberStylesExporter::exportTimeStyle( SdXMLExport& rExport, sal_Int32 nStyle )
389 SAL_WARN_IF( (nStyle < 0) || (nStyle >= SdXMLTimeFormatCount), "xmloff", "Unknown time style!" );
390 if( (nStyle >= 0) && (nStyle < SdXMLTimeFormatCount) )
391 SdXMLExportStyle( rExport, aSdXMLFixedTimeFormats[ nStyle ] );
394 void SdXMLNumberStylesExporter::exportDateStyle( SdXMLExport& rExport, sal_Int32 nStyle )
396 if( nStyle > 0x0f )
398 int nDateStyle = nStyle & 0x0f;
399 bool bHasDate = nDateStyle != 0;
401 if( nDateStyle > 1 )
402 nDateStyle -= 2;
404 SAL_WARN_IF(nDateStyle >= SdXMLDateFormatCount, "xmloff", "unknown date style!");
406 int nTimeStyle = (nStyle >> 4) & 0x0f;
407 bool bHasTime = nTimeStyle != 0;
409 if( nTimeStyle > 1 )
410 nTimeStyle -= 2;
412 SAL_WARN_IF(nTimeStyle >= SdXMLTimeFormatCount, "xmloff", "Unknown time style!");
414 if ((nDateStyle < SdXMLDateFormatCount) && (nTimeStyle < SdXMLTimeFormatCount))
416 if( bHasDate )
418 if( bHasTime )
420 SdXMLExportStyle( rExport, aSdXMLFixedDateFormats[ nDateStyle ], aSdXMLFixedTimeFormats[ nTimeStyle ] );
422 else
424 SdXMLExportStyle( rExport, aSdXMLFixedDateFormats[ nDateStyle ] );
427 else if( bHasTime )
429 SdXMLExportStyle( rExport, aSdXMLFixedTimeFormats[ nTimeStyle ] );
433 else
435 SAL_WARN_IF( (nStyle < 0) || (nStyle >= SdXMLDateFormatCount), "xmloff", "unknown date style!" );
436 if( (nStyle >= 0) && (nStyle < SdXMLDateFormatCount) )
437 SdXMLExportStyle( rExport, aSdXMLFixedDateFormats[ nStyle ] );
441 const OUString & SdXMLNumberStylesExporter::getTimeStyleName(const sal_Int32 nTimeFormat )
443 sal_Int32 nFormat = nTimeFormat;
444 if( nFormat > 1 )
445 nFormat -= 2;
447 if( (nFormat >= 0) && (nFormat < SdXMLTimeFormatCount) )
449 return aSdXMLFixedTimeFormats[nFormat]->maName;
451 else
453 return EMPTY_OUSTRING;
457 OUString SdXMLNumberStylesExporter::getDateStyleName(const sal_Int32 nDateFormat )
459 sal_Int32 nFormat = nDateFormat;
461 if( nFormat > 0x0f )
463 OUString aStr;
464 if( nFormat & 0x0f )
465 aStr = getDateStyleName( nFormat & 0x0f );
466 aStr += getTimeStyleName( (nFormat >> 4) & 0x0f );
467 return aStr;
470 if( nFormat > 1 )
471 nFormat -= 2;
473 if( (nFormat >= 0) && (nFormat < SdXMLDateFormatCount) )
475 return aSdXMLFixedDateFormats[nFormat]->maName;
477 else
479 return OUString();
483 // import
485 class SdXMLNumberFormatMemberImportContext : public SvXMLImportContext
487 private:
488 SdXMLNumberFormatImportContext* mpParent;
490 OUString maNumberStyle;
491 bool mbLong;
492 bool mbTextual;
493 bool mbDecimal02;
494 OUString maText;
495 SvXMLImportContextRef mxSlaveContext;
497 public:
499 SdXMLNumberFormatMemberImportContext( SvXMLImport& rImport,
500 sal_Int32 nElement,
501 const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
502 SdXMLNumberFormatImportContext* pParent,
503 SvXMLImportContextRef xSlaveContext );
505 virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(
506 sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& AttrList ) override;
508 virtual void SAL_CALL startFastElement( sal_Int32 nElement,
509 const css::uno::Reference< css::xml::sax::XFastAttributeList >& ) override;
511 virtual void SAL_CALL endFastElement(sal_Int32 nElement) override;
513 virtual void SAL_CALL characters( const OUString& rChars ) override;
517 SdXMLNumberFormatMemberImportContext::SdXMLNumberFormatMemberImportContext(
518 SvXMLImport& rImport,
519 sal_Int32 nElement,
520 const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList,
521 SdXMLNumberFormatImportContext* pParent,
522 SvXMLImportContextRef xSlaveContext )
523 : SvXMLImportContext(rImport),
524 mpParent( pParent ),
525 maNumberStyle( SvXMLImport::getNameFromToken(nElement) ),
526 mxSlaveContext(std::move( xSlaveContext ))
528 mbLong = false;
529 mbTextual = false;
530 mbDecimal02 = false;
532 for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
534 switch (aIter.getToken())
536 case XML_ELEMENT(NUMBER, XML_DECIMAL_PLACES):
537 mbDecimal02 = IsXMLToken( aIter, XML_2 );
538 break;
539 case XML_ELEMENT(NUMBER, XML_STYLE):
540 mbLong = IsXMLToken( aIter, XML_LONG );
541 break;
542 case XML_ELEMENT(NUMBER, XML_TEXTUAL):
543 mbTextual = IsXMLToken( aIter, XML_TRUE );
544 break;
545 default:
546 XMLOFF_WARN_UNKNOWN("xmloff", aIter);
552 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLNumberFormatMemberImportContext::createFastChildContext(
553 sal_Int32 nElement,
554 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
556 return mxSlaveContext->createFastChildContext( nElement, xAttrList );
559 void SdXMLNumberFormatMemberImportContext::startFastElement(
560 sal_Int32 nElement,
561 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
563 mxSlaveContext->startFastElement( nElement, xAttrList );
566 void SdXMLNumberFormatMemberImportContext::endFastElement(sal_Int32 nElement)
568 mxSlaveContext->endFastElement(nElement);
570 if( mpParent )
571 mpParent->add( maNumberStyle, mbLong, mbTextual, mbDecimal02, maText );
574 void SdXMLNumberFormatMemberImportContext::characters( const OUString& rChars )
576 mxSlaveContext->characters( rChars );
577 maText += rChars;
581 SdXMLNumberFormatImportContext::SdXMLNumberFormatImportContext( SdXMLImport& rImport, sal_Int32 nElement, SvXMLNumImpData* pNewData, SvXMLStylesTokens nNewType, const css::uno::Reference< css::xml::sax::XFastAttributeList>& xAttrList, SvXMLStylesContext& rStyles)
582 : SvXMLNumFormatContext(rImport, nElement, pNewData, nNewType, xAttrList, rStyles),
583 mbAutomatic( false ),
584 mnElements{},
585 mnIndex(0),
586 mnKey( -1 )
588 mbTimeStyle = (nElement & TOKEN_MASK) == XML_TIME_STYLE;
590 for (auto &aIter : sax_fastparser::castToFastAttributeList( xAttrList ))
592 if( aIter.getToken() == XML_ELEMENT(NUMBER, XML_AUTOMATIC_ORDER) )
593 mbAutomatic = IsXMLToken( aIter, XML_TRUE );
594 else
595 XMLOFF_WARN_UNKNOWN("xmloff", aIter);
599 SdXMLNumberFormatImportContext::~SdXMLNumberFormatImportContext()
603 void SdXMLNumberFormatImportContext::add( std::u16string_view rNumberStyle, bool bLong, bool bTextual, bool bDecimal02, std::u16string_view rText )
605 if (mnIndex == 16)
606 return;
608 const SdXMLDataStyleNumber* pStyleMember = aSdXMLDataStyleNumbers;
609 for( sal_uInt8 nIndex = 0; pStyleMember->meNumberStyle != XML_TOKEN_INVALID; nIndex++, pStyleMember++ )
611 if( IsXMLToken(rNumberStyle, pStyleMember->meNumberStyle) &&
612 (pStyleMember->mbLong == bLong) &&
613 (pStyleMember->mbTextual == bTextual) &&
614 (pStyleMember->mbDecimal02 == bDecimal02) &&
615 ( ( (pStyleMember->maText.isEmpty()) && (rText.empty()) ) ||
616 ( !pStyleMember->maText.isEmpty() && rText == pStyleMember->maText ) ) )
618 mnElements[mnIndex++] = static_cast<DataStyleNumber>(nIndex + 1);
619 return;
624 bool SdXMLNumberFormatImportContext::compareStyle( const SdXMLFixedDataStyle* pStyle, sal_Int16& nIndex ) const
626 if( (pStyle->mbAutomatic != mbAutomatic) && (nIndex == 0))
627 return false;
629 sal_Int16 nCompareIndex;
630 for( nCompareIndex = 0; nCompareIndex < 8; nIndex++, nCompareIndex++ )
632 if( pStyle->mpFormat[nCompareIndex] != mnElements[nIndex] )
633 return false;
636 return true;
639 void SdXMLNumberFormatImportContext::endFastElement(sal_Int32 )
641 for( ; mnIndex < 16; mnIndex++ )
643 mnElements[mnIndex] = DataStyleNumber::NONE;
646 if( mbTimeStyle )
648 // compare import with all time styles
649 for( sal_Int16 nFormat = 0; nFormat < SdXMLTimeFormatCount; nFormat++ )
651 sal_Int16 nIndex = 0;
652 if( compareStyle( aSdXMLFixedTimeFormats[nFormat], nIndex ) )
654 mnKey = nFormat + 2;
655 break;
659 else
661 // compare import with all date styles
662 for( sal_Int16 nFormat = 0; nFormat < SdXMLDateFormatCount; nFormat++ )
664 sal_Int16 nIndex = 0;
665 if( compareStyle( aSdXMLFixedDateFormats[nFormat], nIndex ) )
667 mnKey = nFormat + 2;
668 break;
670 else if( mnElements[nIndex] == DataStyleNumber::TextSpace )
672 // if it's a valid date ending with a space, see if a time style follows
673 for( sal_Int16 nTimeFormat = 0; nTimeFormat < SdXMLTimeFormatCount; nTimeFormat++ )
675 sal_Int16 nIndex2 = nIndex + 1;
676 if( compareStyle( aSdXMLFixedTimeFormats[nTimeFormat], nIndex2 ) )
678 mnKey = (nFormat + 2) | ((nTimeFormat + 2) << 4);
679 break;
685 // no date style found? maybe it's an extended time style
686 if( mnKey == -1 )
688 // compare import with all time styles
689 for( sal_Int16 nFormat = 0; nFormat < SdXMLTimeFormatCount; nFormat++ )
691 sal_Int16 nIndex = 0;
692 if( compareStyle( aSdXMLFixedTimeFormats[nFormat], nIndex ) )
694 mnKey = (nFormat + 2) << 4;
695 break;
702 css::uno::Reference< css::xml::sax::XFastContextHandler > SdXMLNumberFormatImportContext::createFastChildContext(
703 sal_Int32 nElement,
704 const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
706 return new SdXMLNumberFormatMemberImportContext( GetImport(), nElement, xAttrList,
707 this, static_cast<SvXMLImportContext*>(SvXMLNumFormatContext::createFastChildContext( nElement, xAttrList ).get()) );
710 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */