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 <boost/shared_ptr.hpp>
21 #include <tools/debug.hxx>
22 #include <XMLNumberStylesExport.hxx>
23 #include <XMLNumberStylesImport.hxx>
24 #include <xmloff/xmlnmspe.hxx>
25 #include <xmloff/xmlimp.hxx>
26 #include <xmloff/nmspmap.hxx>
27 #include <xmloff/xmltoken.hxx>
29 #include "sdxmlexp_impl.hxx"
30 #include "sdxmlimp_impl.hxx"
32 using namespace ::xmloff::token
;
34 struct SdXMLDataStyleNumber
36 enum XMLTokenEnum meNumberStyle
;
42 aSdXMLDataStyleNumbers
[] =
44 { XML_DAY
, false, false, false, NULL
},
45 { XML_DAY
, true, false, false, NULL
},
46 { XML_MONTH
, true, false, false, NULL
},
47 { XML_MONTH
, false, true, false, NULL
},
48 { XML_MONTH
, true, true, false, NULL
},
49 { XML_YEAR
, false, false, false, NULL
},
50 { XML_YEAR
, true, false, false, NULL
},
51 { XML_DAY_OF_WEEK
, false, false, false, NULL
},
52 { XML_DAY_OF_WEEK
, true, false, false, NULL
},
53 { XML_TEXT
, false, false, false, "." },
54 { XML_TEXT
, false, false, false, " " },
55 { XML_TEXT
, false, false, false, ", " },
56 { XML_TEXT
, false, false, false, ". " },
57 { XML_HOURS
, false, false, false, NULL
},
58 { XML_MINUTES
, false, false, false, NULL
},
59 { XML_TEXT
, false, false, false, ":" },
60 { XML_AM_PM
, false, false, false, NULL
},
61 { XML_SECONDS
, false, false, false, NULL
},
62 { XML_SECONDS
, false, false, true, NULL
},
63 { XML_TOKEN_INVALID
, false, false, false, NULL
}
68 #define DATA_STYLE_NUMBER_DAY 1 // <number:day/>
69 #define DATA_STYLE_NUMBER_DAY_LONG 2 // <number:day number:style="long"/>
70 #define DATA_STYLE_NUMBER_MONTH_LONG 3 // <number:month number:style="long"/>
71 #define DATA_STYLE_NUMBER_MONTH_TEXT 4 // <number:month number:textual="true"/>
72 #define DATA_STYLE_NUMBER_MONTH_LONG_TEXT 5 // <number:month number:style="long" number:textual="true"/>
73 #define DATA_STYLE_NUMBER_YEAR 6 // <number:year/>
74 #define DATA_STYLE_NUMBER_YEAR_LONG 7 // <number:year number:style="long"/>
75 #define DATA_STYLE_NUMBER_DAYOFWEEK 8 // <number:day-of-week/>
76 #define DATA_STYLE_NUMBER_DAYOFWEEK_LONG 9 // <number:day-of-week number:style="long"/>
77 #define DATA_STYLE_NUMBER_TEXT_POINT 10 // <number:text>.</number:text>
78 #define DATA_STYLE_NUMBER_TEXT_SPACE 11 // <number:text> </number:text>
79 #define DATA_STYLE_NUMBER_TEXT_COMMASPACE 12 // <number:text>, </number:text>
80 #define DATA_STYLE_NUMBER_TEXT_POINTSPACE 13 // <number:text>. </number:text>
81 #define DATA_STYLE_NUMBER_HOURS 14 // <number:hours/>
82 #define DATA_STYLE_NUMBER_MINUTES 15 // <number:minutes/>
83 #define DATA_STYLE_NUMBER_TEXT_COLON 16 // <number:text>:</number:text>
84 #define DATA_STYLE_NUMBER_AMPM 17 // <number:am-pm/>
85 #define DATA_STYLE_NUMBER_SECONDS 18 // <number:seconds/>
86 #define DATA_STYLE_NUMBER_SECONDS_02 19 // <number:seconds number:/>
88 struct SdXMLFixedDataStyle
93 sal_uInt8 mpFormat
[8];
96 const SdXMLFixedDataStyle aSdXML_Standard_Short
=
100 DATA_STYLE_NUMBER_DAY_LONG
,
101 DATA_STYLE_NUMBER_TEXT_POINT
,
102 DATA_STYLE_NUMBER_MONTH_LONG
,
103 DATA_STYLE_NUMBER_TEXT_POINT
,
104 DATA_STYLE_NUMBER_YEAR_LONG
,
109 const SdXMLFixedDataStyle aSdXML_Standard_Long
=
113 DATA_STYLE_NUMBER_DAYOFWEEK_LONG
,
114 DATA_STYLE_NUMBER_TEXT_COMMASPACE
,
115 DATA_STYLE_NUMBER_DAY
,
116 DATA_STYLE_NUMBER_TEXT_POINTSPACE
,
117 DATA_STYLE_NUMBER_MONTH_LONG_TEXT
,
118 DATA_STYLE_NUMBER_TEXT_SPACE
,
119 DATA_STYLE_NUMBER_YEAR_LONG
,
124 const SdXMLFixedDataStyle aSdXML_DateStyle_1
=
128 DATA_STYLE_NUMBER_DAY_LONG
,
129 DATA_STYLE_NUMBER_TEXT_POINT
,
130 DATA_STYLE_NUMBER_MONTH_LONG
,
131 DATA_STYLE_NUMBER_TEXT_POINT
,
132 DATA_STYLE_NUMBER_YEAR
,
137 const SdXMLFixedDataStyle aSdXML_DateStyle_2
=
141 DATA_STYLE_NUMBER_DAY_LONG
,
142 DATA_STYLE_NUMBER_TEXT_POINT
,
143 DATA_STYLE_NUMBER_MONTH_LONG
,
144 DATA_STYLE_NUMBER_TEXT_POINT
,
145 DATA_STYLE_NUMBER_YEAR_LONG
,
150 const SdXMLFixedDataStyle aSdXML_DateStyle_3
=
154 DATA_STYLE_NUMBER_DAY
,
155 DATA_STYLE_NUMBER_TEXT_POINTSPACE
,
156 DATA_STYLE_NUMBER_MONTH_TEXT
,
157 DATA_STYLE_NUMBER_TEXT_SPACE
,
158 DATA_STYLE_NUMBER_YEAR_LONG
,
163 const SdXMLFixedDataStyle aSdXML_DateStyle_4
=
167 DATA_STYLE_NUMBER_DAY
,
168 DATA_STYLE_NUMBER_TEXT_POINTSPACE
,
169 DATA_STYLE_NUMBER_MONTH_LONG_TEXT
,
170 DATA_STYLE_NUMBER_TEXT_SPACE
,
171 DATA_STYLE_NUMBER_YEAR_LONG
,
176 const SdXMLFixedDataStyle aSdXML_DateStyle_5
=
180 DATA_STYLE_NUMBER_DAYOFWEEK
,
181 DATA_STYLE_NUMBER_TEXT_COMMASPACE
,
182 DATA_STYLE_NUMBER_DAY
,
183 DATA_STYLE_NUMBER_TEXT_POINTSPACE
,
184 DATA_STYLE_NUMBER_MONTH_LONG_TEXT
,
185 DATA_STYLE_NUMBER_TEXT_SPACE
,
186 DATA_STYLE_NUMBER_YEAR_LONG
,
191 const SdXMLFixedDataStyle aSdXML_DateStyle_6
=
195 DATA_STYLE_NUMBER_DAYOFWEEK_LONG
,
196 DATA_STYLE_NUMBER_TEXT_COMMASPACE
,
197 DATA_STYLE_NUMBER_DAY
,
198 DATA_STYLE_NUMBER_TEXT_POINTSPACE
,
199 DATA_STYLE_NUMBER_MONTH_LONG_TEXT
,
200 DATA_STYLE_NUMBER_TEXT_SPACE
,
201 DATA_STYLE_NUMBER_YEAR_LONG
,
206 const SdXMLFixedDataStyle aSdXML_TimeStyle_1
=
209 DATA_STYLE_NUMBER_HOURS
,
210 DATA_STYLE_NUMBER_TEXT_COLON
,
211 DATA_STYLE_NUMBER_MINUTES
,
212 DATA_STYLE_NUMBER_TEXT_COLON
,
213 DATA_STYLE_NUMBER_SECONDS
,
214 DATA_STYLE_NUMBER_AMPM
,
219 const SdXMLFixedDataStyle aSdXML_TimeStyle_2
=
220 { "T2", false, false,
222 DATA_STYLE_NUMBER_HOURS
,
223 DATA_STYLE_NUMBER_TEXT_COLON
,
224 DATA_STYLE_NUMBER_MINUTES
,
229 const SdXMLFixedDataStyle aSdXML_TimeStyle_3
=
230 { "T3", false, false,
232 DATA_STYLE_NUMBER_HOURS
,
233 DATA_STYLE_NUMBER_TEXT_COLON
,
234 DATA_STYLE_NUMBER_MINUTES
,
235 DATA_STYLE_NUMBER_TEXT_COLON
,
236 DATA_STYLE_NUMBER_SECONDS
,
241 const SdXMLFixedDataStyle aSdXML_TimeStyle_4
=
242 { "T4", false, false,
244 DATA_STYLE_NUMBER_HOURS
,
245 DATA_STYLE_NUMBER_TEXT_COLON
,
246 DATA_STYLE_NUMBER_MINUTES
,
247 DATA_STYLE_NUMBER_TEXT_COLON
,
248 DATA_STYLE_NUMBER_SECONDS_02
,
253 const SdXMLFixedDataStyle aSdXML_TimeStyle_5
=
254 { "T5", false, false,
256 DATA_STYLE_NUMBER_HOURS
,
257 DATA_STYLE_NUMBER_TEXT_COLON
,
258 DATA_STYLE_NUMBER_MINUTES
,
259 DATA_STYLE_NUMBER_AMPM
,
264 const SdXMLFixedDataStyle aSdXML_TimeStyle_6
=
265 { "T6", false, false,
267 DATA_STYLE_NUMBER_HOURS
,
268 DATA_STYLE_NUMBER_TEXT_COLON
,
269 DATA_STYLE_NUMBER_MINUTES
,
270 DATA_STYLE_NUMBER_TEXT_COLON
,
271 DATA_STYLE_NUMBER_SECONDS
,
272 DATA_STYLE_NUMBER_AMPM
,
277 const SdXMLFixedDataStyle aSdXML_TimeStyle_7
=
278 { "T7", false, false,
280 DATA_STYLE_NUMBER_HOURS
,
281 DATA_STYLE_NUMBER_TEXT_COLON
,
282 DATA_STYLE_NUMBER_MINUTES
,
283 DATA_STYLE_NUMBER_TEXT_COLON
,
284 DATA_STYLE_NUMBER_SECONDS_02
,
285 DATA_STYLE_NUMBER_AMPM
,
290 const SdXMLFixedDataStyle
* aSdXMLFixedDateFormats
[SdXMLDateFormatCount
] =
292 &aSdXML_Standard_Short
,
293 &aSdXML_Standard_Long
,
302 const SdXMLFixedDataStyle
* aSdXMLFixedTimeFormats
[SdXMLTimeFormatCount
] =
315 static void SdXMLExportDataStyleNumber( SdXMLExport
& rExport
, SdXMLDataStyleNumber
& rElement
)
317 if( rElement
.mbDecimal02
)
319 rExport
.AddAttribute( XML_NAMESPACE_NUMBER
, XML_DECIMAL_PLACES
, XML_2
);
322 if( rElement
.mbLong
)
324 rExport
.AddAttribute( XML_NAMESPACE_NUMBER
, XML_STYLE
, XML_LONG
);
327 if( rElement
.mbTextual
)
329 rExport
.AddAttribute( XML_NAMESPACE_NUMBER
, XML_TEXTUAL
, XML_TRUE
);
332 SvXMLElementExport
aNumberStyle( rExport
, XML_NAMESPACE_NUMBER
, rElement
.meNumberStyle
, true, false );
333 if( rElement
.mpText
)
335 OUString
sAttrValue( OUString::createFromAscii( rElement
.mpText
) );
336 rExport
.GetDocHandler()->characters( sAttrValue
);
340 static void SdXMLExportStyle( SdXMLExport
& rExport
, const SdXMLFixedDataStyle
* pStyle
, const SdXMLFixedDataStyle
* pStyle2
= NULL
)
345 sAttrValue
= OUString::createFromAscii( pStyle
->mpName
);
347 sAttrValue
+= OUString::createFromAscii( pStyle2
->mpName
);
349 rExport
.AddAttribute( XML_NAMESPACE_STYLE
, XML_NAME
, sAttrValue
);
351 if( pStyle
->mbAutomatic
)
353 rExport
.AddAttribute( XML_NAMESPACE_NUMBER
, XML_AUTOMATIC_ORDER
, XML_TRUE
);
356 SvXMLElementExport
aElement( rExport
, XML_NAMESPACE_NUMBER
, pStyle
->mbDateStyle
? XML_DATE_STYLE
: XML_TIME_STYLE
, true, true );
361 const sal_uInt8
* pElements
= &pStyle
->mpFormat
[0];
365 SdXMLDataStyleNumber
& rElement
= aSdXMLDataStyleNumbers
[ (*pElements
++) - 1 ];
366 SdXMLExportDataStyleNumber( rExport
, rElement
);
371 SdXMLDataStyleNumber
& rElement
= aSdXMLDataStyleNumbers
[ DATA_STYLE_NUMBER_TEXT_SPACE
- 1 ];
372 SdXMLExportDataStyleNumber( rExport
, rElement
);
381 void SdXMLNumberStylesExporter::exportTimeStyle( SdXMLExport
& rExport
, sal_Int32 nStyle
)
383 DBG_ASSERT( (nStyle
>= 0) && (nStyle
< SdXMLTimeFormatCount
), "Unknown time style!" );
384 if( (nStyle
>= 0) && (nStyle
< SdXMLTimeFormatCount
) )
385 SdXMLExportStyle( rExport
, aSdXMLFixedTimeFormats
[ nStyle
] );
388 void SdXMLNumberStylesExporter::exportDateStyle( SdXMLExport
& rExport
, sal_Int32 nStyle
)
392 int nDateStyle
= nStyle
& 0x0f;
393 bool bHasDate
= nDateStyle
!= 0;
398 DBG_ASSERT( (nDateStyle
>= 0) && (nDateStyle
< SdXMLDateFormatCount
), "unknown date style!" );
400 int nTimeStyle
= (nStyle
>> 4) & 0x0f;
401 bool bHasTime
= nTimeStyle
!= 0;
406 DBG_ASSERT( (nTimeStyle
>= 0) && (nTimeStyle
< SdXMLTimeFormatCount
), "Unknown time style!" );
408 if( (nDateStyle
>= 0) && (nDateStyle
< SdXMLDateFormatCount
) && (nTimeStyle
>= 0) && (nTimeStyle
< SdXMLTimeFormatCount
) )
414 SdXMLExportStyle( rExport
, aSdXMLFixedDateFormats
[ nDateStyle
], aSdXMLFixedTimeFormats
[ nTimeStyle
] );
418 SdXMLExportStyle( rExport
, aSdXMLFixedDateFormats
[ nDateStyle
] );
423 SdXMLExportStyle( rExport
, aSdXMLFixedTimeFormats
[ nTimeStyle
] );
429 DBG_ASSERT( (nStyle
>= 0) && (nStyle
< SdXMLDateFormatCount
), "unknown date style!" );
430 if( (nStyle
>= 0) && (nStyle
< SdXMLDateFormatCount
) )
431 SdXMLExportStyle( rExport
, aSdXMLFixedDateFormats
[ nStyle
] );
435 OUString
SdXMLNumberStylesExporter::getTimeStyleName(const sal_Int32 nTimeFormat
)
437 sal_Int32 nFormat
= nTimeFormat
;
441 if( (nFormat
>= 0) && (nFormat
< SdXMLTimeFormatCount
) )
443 return OUString::createFromAscii(aSdXMLFixedTimeFormats
[nFormat
]->mpName
);
451 OUString
SdXMLNumberStylesExporter::getDateStyleName(const sal_Int32 nDateFormat
)
453 sal_Int32 nFormat
= nDateFormat
;
459 aStr
= getDateStyleName( nFormat
& 0x0f );
460 aStr
+= getTimeStyleName( (nFormat
>> 4) & 0x0f );
467 if( (nFormat
>= 0) && (nFormat
< SdXMLDateFormatCount
) )
469 return OUString::createFromAscii(aSdXMLFixedDateFormats
[nFormat
]->mpName
);
479 class SdXMLNumberFormatMemberImportContext
: public SvXMLImportContext
482 SdXMLNumberFormatImportContext
* mpParent
;
484 OUString maNumberStyle
;
489 boost::shared_ptr
< SvXMLImportContext
> mpSlaveContext
;
494 SdXMLNumberFormatMemberImportContext( SvXMLImport
& rImport
,
496 const OUString
& rLocalName
,
497 const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
,
498 SdXMLNumberFormatImportContext
* pParent
,
499 SvXMLImportContext
* pSlaveContext
);
500 virtual ~SdXMLNumberFormatMemberImportContext();
502 virtual SvXMLImportContext
*CreateChildContext( sal_uInt16 nPrefix
,
503 const OUString
& rLocalName
,
504 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
506 virtual void StartElement( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
) SAL_OVERRIDE
;
508 virtual void EndElement() SAL_OVERRIDE
;
510 virtual void Characters( const OUString
& rChars
) SAL_OVERRIDE
;
513 TYPEINIT1( SdXMLNumberFormatMemberImportContext
, SvXMLImportContext
);
515 SdXMLNumberFormatMemberImportContext::SdXMLNumberFormatMemberImportContext( SvXMLImport
& rImport
, sal_uInt16 nPrfx
, const OUString
& rLocalName
, const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
, SdXMLNumberFormatImportContext
* pParent
, SvXMLImportContext
* pSlaveContext
)
516 : SvXMLImportContext(rImport
, nPrfx
, rLocalName
),
518 maNumberStyle( rLocalName
),
519 mpSlaveContext( pSlaveContext
)
525 const sal_Int16 nAttrCount
= xAttrList
.is() ? xAttrList
->getLength() : 0;
526 for(sal_Int16 i
=0; i
< nAttrCount
; i
++)
528 OUString sAttrName
= xAttrList
->getNameByIndex( i
);
530 sal_uInt16 nPrefix
= GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName
, &aLocalName
);
531 OUString sValue
= xAttrList
->getValueByIndex( i
);
533 if( nPrefix
== XML_NAMESPACE_NUMBER
)
535 if( IsXMLToken( aLocalName
, XML_DECIMAL_PLACES
) )
537 mbDecimal02
= IsXMLToken( sValue
, XML_2
);
539 else if( IsXMLToken( aLocalName
, XML_STYLE
) )
541 mbLong
= IsXMLToken( sValue
, XML_LONG
);
543 else if( IsXMLToken( aLocalName
, XML_TEXTUAL
) )
545 mbTextual
= IsXMLToken( sValue
, XML_TRUE
);
552 SdXMLNumberFormatMemberImportContext::~SdXMLNumberFormatMemberImportContext()
556 SvXMLImportContext
*SdXMLNumberFormatMemberImportContext::CreateChildContext( sal_uInt16 nPrefix
,
557 const OUString
& rLocalName
,
558 const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
)
560 return mpSlaveContext
->CreateChildContext( nPrefix
, rLocalName
, xAttrList
);
563 void SdXMLNumberFormatMemberImportContext::StartElement( const ::com::sun::star::uno::Reference
< ::com::sun::star::xml::sax::XAttributeList
>& xAttrList
)
565 mpSlaveContext
->StartElement( xAttrList
);
568 void SdXMLNumberFormatMemberImportContext::EndElement()
570 mpSlaveContext
->EndElement();
573 mpParent
->add( maNumberStyle
, mbLong
, mbTextual
, mbDecimal02
, maText
);
576 void SdXMLNumberFormatMemberImportContext::Characters( const OUString
& rChars
)
578 mpSlaveContext
->Characters( rChars
);
582 TYPEINIT1( SdXMLNumberFormatImportContext
, SvXMLImportContext
);
584 SdXMLNumberFormatImportContext::SdXMLNumberFormatImportContext( SdXMLImport
& rImport
, sal_uInt16 nPrfx
, const OUString
& rLocalName
, SvXMLNumImpData
* pNewData
, sal_uInt16 nNewType
, const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
, SvXMLStylesContext
& rStyles
)
585 : SvXMLNumFormatContext(rImport
, nPrfx
, rLocalName
, pNewData
, nNewType
, xAttrList
, rStyles
),
586 mbAutomatic( false ),
590 mbTimeStyle
= IsXMLToken( rLocalName
, XML_TIME_STYLE
);
592 const sal_Int16 nAttrCount
= xAttrList
.is() ? xAttrList
->getLength() : 0;
593 for(sal_Int16 i
=0; i
< nAttrCount
; i
++)
595 OUString sAttrName
= xAttrList
->getNameByIndex( i
);
597 sal_uInt16 nPrefix
= GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName
, &aLocalName
);
598 OUString sValue
= xAttrList
->getValueByIndex( i
);
600 if( nPrefix
== XML_NAMESPACE_NUMBER
)
602 if( IsXMLToken( aLocalName
, XML_AUTOMATIC_ORDER
) )
604 mbAutomatic
= IsXMLToken( sValue
, XML_TRUE
);
610 SdXMLNumberFormatImportContext::~SdXMLNumberFormatImportContext()
614 void SdXMLNumberFormatImportContext::add( OUString
& rNumberStyle
, bool bLong
, bool bTextual
, bool bDecimal02
, OUString
& rText
)
616 if( mnIndex
== -1 || mnIndex
== 16 )
622 const SdXMLDataStyleNumber
* pStyleMember
= aSdXMLDataStyleNumbers
;
623 for( sal_uInt8 nIndex
= 0; pStyleMember
->meNumberStyle
!= XML_TOKEN_INVALID
; nIndex
++, pStyleMember
++ )
625 if( (IsXMLToken(rNumberStyle
, pStyleMember
->meNumberStyle
) &&
626 (pStyleMember
->mbLong
== bLong
) &&
627 (pStyleMember
->mbTextual
== bTextual
) &&
628 (pStyleMember
->mbDecimal02
== bDecimal02
) &&
629 ( ( (pStyleMember
->mpText
== NULL
) && (rText
.isEmpty()) ) ||
630 ( pStyleMember
->mpText
&& (rText
.equalsAscii( pStyleMember
->mpText
) ) ) ) ) )
632 mnElements
[mnIndex
++] = nIndex
+ 1;
638 bool SdXMLNumberFormatImportContext::compareStyle( const SdXMLFixedDataStyle
* pStyle
, sal_Int16
& nIndex
) const
640 if( (pStyle
->mbAutomatic
!= mbAutomatic
) && (nIndex
== 0))
643 sal_Int16 nCompareIndex
;
644 for( nCompareIndex
= 0; nCompareIndex
< 8; nIndex
++, nCompareIndex
++ )
646 if( pStyle
->mpFormat
[nCompareIndex
] != mnElements
[nIndex
] )
653 void SdXMLNumberFormatImportContext::EndElement()
655 SvXMLNumFormatContext::EndElement();
657 for( ; mnIndex
< 16; mnIndex
++ )
659 mnElements
[mnIndex
] = 0;
664 // compare import with all time styles
665 for( sal_Int16 nFormat
= 0; nFormat
< SdXMLTimeFormatCount
; nFormat
++ )
667 sal_Int16 nIndex
= 0;
668 if( compareStyle( aSdXMLFixedTimeFormats
[nFormat
], nIndex
) )
677 // compare import with all date styles
678 for( sal_Int16 nFormat
= 0; nFormat
< SdXMLDateFormatCount
; nFormat
++ )
680 sal_Int16 nIndex
= 0;
681 if( compareStyle( aSdXMLFixedDateFormats
[nFormat
], nIndex
) )
686 else if( mnElements
[nIndex
] == DATA_STYLE_NUMBER_TEXT_SPACE
)
688 // if it's a valid date ending with a space, see if a time style follows
689 for( sal_Int16 nTimeFormat
= 0; nTimeFormat
< SdXMLTimeFormatCount
; nTimeFormat
++ )
691 sal_Int16 nIndex2
= nIndex
+ 1;
692 if( compareStyle( aSdXMLFixedTimeFormats
[nTimeFormat
], nIndex2
) )
694 mnKey
= (nFormat
+ 2) | ((nTimeFormat
+ 2) << 4);
701 // no date style found? maybe its an extended time style
704 // compare import with all time styles
705 for( sal_Int16 nFormat
= 0; nFormat
< SdXMLTimeFormatCount
; nFormat
++ )
707 sal_Int16 nIndex
= 0;
708 if( compareStyle( aSdXMLFixedTimeFormats
[nFormat
], nIndex
) )
710 mnKey
= (nFormat
+ 2) << 4;
718 SvXMLImportContext
* SdXMLNumberFormatImportContext::CreateChildContext( sal_uInt16 nPrefix
, const OUString
& rLocalName
, const com::sun::star::uno::Reference
< com::sun::star::xml::sax::XAttributeList
>& xAttrList
)
720 return new SdXMLNumberFormatMemberImportContext( GetImport(), nPrefix
, rLocalName
, xAttrList
, this, SvXMLNumFormatContext::CreateChildContext( nPrefix
, rLocalName
, xAttrList
) );
723 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */