1*63bba73cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*63bba73cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*63bba73cSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*63bba73cSAndrew Rist * distributed with this work for additional information 6*63bba73cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*63bba73cSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*63bba73cSAndrew Rist * "License"); you may not use this file except in compliance 9*63bba73cSAndrew Rist * with the License. You may obtain a copy of the License at 10*63bba73cSAndrew Rist * 11*63bba73cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*63bba73cSAndrew Rist * 13*63bba73cSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*63bba73cSAndrew Rist * software distributed under the License is distributed on an 15*63bba73cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*63bba73cSAndrew Rist * KIND, either express or implied. See the License for the 17*63bba73cSAndrew Rist * specific language governing permissions and limitations 18*63bba73cSAndrew Rist * under the License. 19*63bba73cSAndrew Rist * 20*63bba73cSAndrew Rist *************************************************************/ 21*63bba73cSAndrew Rist 22*63bba73cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_xmloff.hxx" 26cdf0e10cSrcweir #include <tools/debug.hxx> 27cdf0e10cSrcweir #include <XMLNumberStylesExport.hxx> 28cdf0e10cSrcweir #include <XMLNumberStylesImport.hxx> 29cdf0e10cSrcweir #include "xmloff/xmlnmspe.hxx" 30cdf0e10cSrcweir #include <xmloff/xmlimp.hxx> 31cdf0e10cSrcweir #include <xmloff/nmspmap.hxx> 32cdf0e10cSrcweir #include <xmloff/xmltoken.hxx> 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include "sdxmlexp_impl.hxx" 35cdf0e10cSrcweir #include "sdxmlimp_impl.hxx" 36cdf0e10cSrcweir 37cdf0e10cSrcweir using namespace rtl; 38cdf0e10cSrcweir using namespace ::xmloff::token; 39cdf0e10cSrcweir 40cdf0e10cSrcweir struct SdXMLDataStyleNumber 41cdf0e10cSrcweir { 42cdf0e10cSrcweir enum XMLTokenEnum meNumberStyle; 43cdf0e10cSrcweir sal_Bool mbLong; 44cdf0e10cSrcweir sal_Bool mbTextual; 45cdf0e10cSrcweir sal_Bool mbDecimal02; 46cdf0e10cSrcweir const char* mpText; 47cdf0e10cSrcweir } 48cdf0e10cSrcweir aSdXMLDataStyleNumbers[] = 49cdf0e10cSrcweir { 50cdf0e10cSrcweir { XML_DAY, sal_False, sal_False, sal_False, NULL }, 51cdf0e10cSrcweir { XML_DAY, sal_True, sal_False, sal_False, NULL }, 52cdf0e10cSrcweir { XML_MONTH, sal_True, sal_False, sal_False, NULL }, 53cdf0e10cSrcweir { XML_MONTH, sal_False, sal_True, sal_False, NULL }, 54cdf0e10cSrcweir { XML_MONTH, sal_True, sal_True, sal_False, NULL }, 55cdf0e10cSrcweir { XML_YEAR, sal_False, sal_False, sal_False, NULL }, 56cdf0e10cSrcweir { XML_YEAR, sal_True, sal_False, sal_False, NULL }, 57cdf0e10cSrcweir { XML_DAY_OF_WEEK, sal_False, sal_False, sal_False, NULL }, 58cdf0e10cSrcweir { XML_DAY_OF_WEEK, sal_True, sal_False, sal_False, NULL }, 59cdf0e10cSrcweir { XML_TEXT, sal_False, sal_False, sal_False, "." }, 60cdf0e10cSrcweir { XML_TEXT, sal_False, sal_False, sal_False, " " }, 61cdf0e10cSrcweir { XML_TEXT, sal_False, sal_False, sal_False, ", " }, 62cdf0e10cSrcweir { XML_TEXT, sal_False, sal_False, sal_False, ". " }, 63cdf0e10cSrcweir { XML_HOURS, sal_False, sal_False, sal_False, NULL }, 64cdf0e10cSrcweir { XML_MINUTES, sal_False, sal_False, sal_False, NULL }, 65cdf0e10cSrcweir { XML_TEXT, sal_False, sal_False, sal_False, ":" }, 66cdf0e10cSrcweir { XML_AM_PM, sal_False, sal_False, sal_False, NULL }, 67cdf0e10cSrcweir { XML_SECONDS, sal_False, sal_False, sal_False, NULL }, 68cdf0e10cSrcweir { XML_SECONDS, sal_False, sal_False, sal_True, NULL }, 69cdf0e10cSrcweir { XML_TOKEN_INVALID, 0, 0, 0, NULL } 70cdf0e10cSrcweir }; 71cdf0e10cSrcweir 72cdf0e10cSrcweir // date 73cdf0e10cSrcweir 74cdf0e10cSrcweir #define DATA_STYLE_NUMBER_END 0 75cdf0e10cSrcweir #define DATA_STYLE_NUMBER_DAY 1 // <number:day/> 76cdf0e10cSrcweir #define DATA_STYLE_NUMBER_DAY_LONG 2 // <number:day number:style="long"/> 77cdf0e10cSrcweir #define DATA_STYLE_NUMBER_MONTH_LONG 3 // <number:month number:style="long"/> 78cdf0e10cSrcweir #define DATA_STYLE_NUMBER_MONTH_TEXT 4 // <number:month number:textual="true"/> 79cdf0e10cSrcweir #define DATA_STYLE_NUMBER_MONTH_LONG_TEXT 5 // <number:month number:style="long" number:textual="true"/> 80cdf0e10cSrcweir #define DATA_STYLE_NUMBER_YEAR 6 // <number:year/> 81cdf0e10cSrcweir #define DATA_STYLE_NUMBER_YEAR_LONG 7 // <number:year number:style="long"/> 82cdf0e10cSrcweir #define DATA_STYLE_NUMBER_DAYOFWEEK 8 // <number:day-of-week/> 83cdf0e10cSrcweir #define DATA_STYLE_NUMBER_DAYOFWEEK_LONG 9 // <number:day-of-week number:style="long"/> 84cdf0e10cSrcweir #define DATA_STYLE_NUMBER_TEXT_POINT 10 // <number:text>.</number:text> 85cdf0e10cSrcweir #define DATA_STYLE_NUMBER_TEXT_SPACE 11 // <number:text> </number:text> 86cdf0e10cSrcweir #define DATA_STYLE_NUMBER_TEXT_COMMASPACE 12 // <number:text>, </number:text> 87cdf0e10cSrcweir #define DATA_STYLE_NUMBER_TEXT_POINTSPACE 13 // <number:text>. </number:text> 88cdf0e10cSrcweir #define DATA_STYLE_NUMBER_HOURS 14 // <number:hours/> 89cdf0e10cSrcweir #define DATA_STYLE_NUMBER_MINUTES 15 // <number:minutes/> 90cdf0e10cSrcweir #define DATA_STYLE_NUMBER_TEXT_COLON 16 // <number:text>:</number:text> 91cdf0e10cSrcweir #define DATA_STYLE_NUMBER_AMPM 17 // <number:am-pm/> 92cdf0e10cSrcweir #define DATA_STYLE_NUMBER_SECONDS 18 // <number:seconds/> 93cdf0e10cSrcweir #define DATA_STYLE_NUMBER_SECONDS_02 19 // <number:seconds number:/> 94cdf0e10cSrcweir 95cdf0e10cSrcweir 96cdf0e10cSrcweir struct SdXMLFixedDataStyle 97cdf0e10cSrcweir { 98cdf0e10cSrcweir const char* mpName; 99cdf0e10cSrcweir sal_Bool mbAutomatic; 100cdf0e10cSrcweir sal_Bool mbDateStyle; 101cdf0e10cSrcweir sal_uInt8 mpFormat[8]; 102cdf0e10cSrcweir }; 103cdf0e10cSrcweir 104cdf0e10cSrcweir const SdXMLFixedDataStyle aSdXML_Standard_Short = 105cdf0e10cSrcweir { 106cdf0e10cSrcweir "D1", sal_True, sal_True, 107cdf0e10cSrcweir { 108cdf0e10cSrcweir DATA_STYLE_NUMBER_DAY_LONG, 109cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_POINT, 110cdf0e10cSrcweir DATA_STYLE_NUMBER_MONTH_LONG, 111cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_POINT, 112cdf0e10cSrcweir DATA_STYLE_NUMBER_YEAR_LONG, 113cdf0e10cSrcweir 0, 0, 0 114cdf0e10cSrcweir } 115cdf0e10cSrcweir }; 116cdf0e10cSrcweir 117cdf0e10cSrcweir const SdXMLFixedDataStyle aSdXML_Standard_Long = 118cdf0e10cSrcweir { 119cdf0e10cSrcweir "D2", sal_True, sal_True, 120cdf0e10cSrcweir { 121cdf0e10cSrcweir DATA_STYLE_NUMBER_DAYOFWEEK_LONG, 122cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_COMMASPACE, 123cdf0e10cSrcweir DATA_STYLE_NUMBER_DAY, 124cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_POINTSPACE, 125cdf0e10cSrcweir DATA_STYLE_NUMBER_MONTH_LONG_TEXT, 126cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_SPACE, 127cdf0e10cSrcweir DATA_STYLE_NUMBER_YEAR_LONG, 128cdf0e10cSrcweir 0 129cdf0e10cSrcweir } 130cdf0e10cSrcweir }; 131cdf0e10cSrcweir 132cdf0e10cSrcweir const SdXMLFixedDataStyle aSdXML_DateStyle_1 = 133cdf0e10cSrcweir { 134cdf0e10cSrcweir "D3", sal_False, sal_True, 135cdf0e10cSrcweir { 136cdf0e10cSrcweir DATA_STYLE_NUMBER_DAY_LONG, 137cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_POINT, 138cdf0e10cSrcweir DATA_STYLE_NUMBER_MONTH_LONG, 139cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_POINT, 140cdf0e10cSrcweir DATA_STYLE_NUMBER_YEAR, 141cdf0e10cSrcweir 0, 0, 0 142cdf0e10cSrcweir } 143cdf0e10cSrcweir }; 144cdf0e10cSrcweir 145cdf0e10cSrcweir const SdXMLFixedDataStyle aSdXML_DateStyle_2 = 146cdf0e10cSrcweir { 147cdf0e10cSrcweir "D4", sal_False, sal_True, 148cdf0e10cSrcweir { 149cdf0e10cSrcweir DATA_STYLE_NUMBER_DAY_LONG, 150cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_POINT, 151cdf0e10cSrcweir DATA_STYLE_NUMBER_MONTH_LONG, 152cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_POINT, 153cdf0e10cSrcweir DATA_STYLE_NUMBER_YEAR_LONG, 154cdf0e10cSrcweir 0, 0, 0 155cdf0e10cSrcweir } 156cdf0e10cSrcweir }; 157cdf0e10cSrcweir 158cdf0e10cSrcweir const SdXMLFixedDataStyle aSdXML_DateStyle_3 = 159cdf0e10cSrcweir { 160cdf0e10cSrcweir "D5", sal_False, sal_True, 161cdf0e10cSrcweir { 162cdf0e10cSrcweir DATA_STYLE_NUMBER_DAY, 163cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_POINTSPACE, 164cdf0e10cSrcweir DATA_STYLE_NUMBER_MONTH_TEXT, 165cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_SPACE, 166cdf0e10cSrcweir DATA_STYLE_NUMBER_YEAR_LONG, 167cdf0e10cSrcweir 0, 0, 0 168cdf0e10cSrcweir } 169cdf0e10cSrcweir }; 170cdf0e10cSrcweir 171cdf0e10cSrcweir const SdXMLFixedDataStyle aSdXML_DateStyle_4 = 172cdf0e10cSrcweir { 173cdf0e10cSrcweir "D6", sal_False, sal_True, 174cdf0e10cSrcweir { 175cdf0e10cSrcweir DATA_STYLE_NUMBER_DAY, 176cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_POINTSPACE, 177cdf0e10cSrcweir DATA_STYLE_NUMBER_MONTH_LONG_TEXT, 178cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_SPACE, 179cdf0e10cSrcweir DATA_STYLE_NUMBER_YEAR_LONG, 180cdf0e10cSrcweir 0, 0, 0 181cdf0e10cSrcweir } 182cdf0e10cSrcweir }; 183cdf0e10cSrcweir 184cdf0e10cSrcweir const SdXMLFixedDataStyle aSdXML_DateStyle_5 = 185cdf0e10cSrcweir { 186cdf0e10cSrcweir "D7", sal_False, sal_True, 187cdf0e10cSrcweir { 188cdf0e10cSrcweir DATA_STYLE_NUMBER_DAYOFWEEK, 189cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_COMMASPACE, 190cdf0e10cSrcweir DATA_STYLE_NUMBER_DAY, 191cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_POINTSPACE, 192cdf0e10cSrcweir DATA_STYLE_NUMBER_MONTH_LONG_TEXT, 193cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_SPACE, 194cdf0e10cSrcweir DATA_STYLE_NUMBER_YEAR_LONG, 195cdf0e10cSrcweir 0 196cdf0e10cSrcweir } 197cdf0e10cSrcweir }; 198cdf0e10cSrcweir 199cdf0e10cSrcweir const SdXMLFixedDataStyle aSdXML_DateStyle_6 = 200cdf0e10cSrcweir { 201cdf0e10cSrcweir "D8", sal_False, sal_True, 202cdf0e10cSrcweir { 203cdf0e10cSrcweir DATA_STYLE_NUMBER_DAYOFWEEK_LONG, 204cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_COMMASPACE, 205cdf0e10cSrcweir DATA_STYLE_NUMBER_DAY, 206cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_POINTSPACE, 207cdf0e10cSrcweir DATA_STYLE_NUMBER_MONTH_LONG_TEXT, 208cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_SPACE, 209cdf0e10cSrcweir DATA_STYLE_NUMBER_YEAR_LONG, 210cdf0e10cSrcweir 0 211cdf0e10cSrcweir } 212cdf0e10cSrcweir }; 213cdf0e10cSrcweir 214cdf0e10cSrcweir const SdXMLFixedDataStyle aSdXML_TimeStyle_1 = 215cdf0e10cSrcweir { "T1", sal_True, sal_False, 216cdf0e10cSrcweir { 217cdf0e10cSrcweir DATA_STYLE_NUMBER_HOURS, 218cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_COLON, 219cdf0e10cSrcweir DATA_STYLE_NUMBER_MINUTES, 220cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_COLON, 221cdf0e10cSrcweir DATA_STYLE_NUMBER_SECONDS, 222cdf0e10cSrcweir DATA_STYLE_NUMBER_AMPM, 223cdf0e10cSrcweir 0, 0, 224cdf0e10cSrcweir } 225cdf0e10cSrcweir }; 226cdf0e10cSrcweir 227cdf0e10cSrcweir const SdXMLFixedDataStyle aSdXML_TimeStyle_2 = 228cdf0e10cSrcweir { "T2", sal_False, sal_False, 229cdf0e10cSrcweir { 230cdf0e10cSrcweir DATA_STYLE_NUMBER_HOURS, 231cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_COLON, 232cdf0e10cSrcweir DATA_STYLE_NUMBER_MINUTES, 233cdf0e10cSrcweir 0, 0, 0, 0, 0 234cdf0e10cSrcweir } 235cdf0e10cSrcweir }; 236cdf0e10cSrcweir 237cdf0e10cSrcweir const SdXMLFixedDataStyle aSdXML_TimeStyle_3 = 238cdf0e10cSrcweir { "T3", sal_False, sal_False, 239cdf0e10cSrcweir { 240cdf0e10cSrcweir DATA_STYLE_NUMBER_HOURS, 241cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_COLON, 242cdf0e10cSrcweir DATA_STYLE_NUMBER_MINUTES, 243cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_COLON, 244cdf0e10cSrcweir DATA_STYLE_NUMBER_SECONDS, 245cdf0e10cSrcweir 0, 0, 0 246cdf0e10cSrcweir } 247cdf0e10cSrcweir }; 248cdf0e10cSrcweir 249cdf0e10cSrcweir const SdXMLFixedDataStyle aSdXML_TimeStyle_4 = 250cdf0e10cSrcweir { "T4", sal_False, sal_False, 251cdf0e10cSrcweir { 252cdf0e10cSrcweir DATA_STYLE_NUMBER_HOURS, 253cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_COLON, 254cdf0e10cSrcweir DATA_STYLE_NUMBER_MINUTES, 255cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_COLON, 256cdf0e10cSrcweir DATA_STYLE_NUMBER_SECONDS_02, 257cdf0e10cSrcweir 0, 0, 0 258cdf0e10cSrcweir } 259cdf0e10cSrcweir }; 260cdf0e10cSrcweir 261cdf0e10cSrcweir const SdXMLFixedDataStyle aSdXML_TimeStyle_5 = 262cdf0e10cSrcweir { "T5", sal_False, sal_False, 263cdf0e10cSrcweir { 264cdf0e10cSrcweir DATA_STYLE_NUMBER_HOURS, 265cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_COLON, 266cdf0e10cSrcweir DATA_STYLE_NUMBER_MINUTES, 267cdf0e10cSrcweir DATA_STYLE_NUMBER_AMPM, 268cdf0e10cSrcweir 0, 0, 0, 0 269cdf0e10cSrcweir } 270cdf0e10cSrcweir }; 271cdf0e10cSrcweir 272cdf0e10cSrcweir const SdXMLFixedDataStyle aSdXML_TimeStyle_6 = 273cdf0e10cSrcweir { "T6", sal_False, sal_False, 274cdf0e10cSrcweir { 275cdf0e10cSrcweir DATA_STYLE_NUMBER_HOURS, 276cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_COLON, 277cdf0e10cSrcweir DATA_STYLE_NUMBER_MINUTES, 278cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_COLON, 279cdf0e10cSrcweir DATA_STYLE_NUMBER_SECONDS, 280cdf0e10cSrcweir DATA_STYLE_NUMBER_AMPM, 281cdf0e10cSrcweir 0, 0 282cdf0e10cSrcweir } 283cdf0e10cSrcweir }; 284cdf0e10cSrcweir 285cdf0e10cSrcweir const SdXMLFixedDataStyle aSdXML_TimeStyle_7 = 286cdf0e10cSrcweir { "T7", sal_False, sal_False, 287cdf0e10cSrcweir { 288cdf0e10cSrcweir DATA_STYLE_NUMBER_HOURS, 289cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_COLON, 290cdf0e10cSrcweir DATA_STYLE_NUMBER_MINUTES, 291cdf0e10cSrcweir DATA_STYLE_NUMBER_TEXT_COLON, 292cdf0e10cSrcweir DATA_STYLE_NUMBER_SECONDS_02, 293cdf0e10cSrcweir DATA_STYLE_NUMBER_AMPM, 294cdf0e10cSrcweir 0, 0 295cdf0e10cSrcweir } 296cdf0e10cSrcweir }; 297cdf0e10cSrcweir 298cdf0e10cSrcweir const SdXMLFixedDataStyle* aSdXMLFixedDateFormats[SdXMLDateFormatCount] = 299cdf0e10cSrcweir { 300cdf0e10cSrcweir &aSdXML_Standard_Short, 301cdf0e10cSrcweir &aSdXML_Standard_Long, 302cdf0e10cSrcweir &aSdXML_DateStyle_1, 303cdf0e10cSrcweir &aSdXML_DateStyle_2, 304cdf0e10cSrcweir &aSdXML_DateStyle_3, 305cdf0e10cSrcweir &aSdXML_DateStyle_4, 306cdf0e10cSrcweir &aSdXML_DateStyle_5, 307cdf0e10cSrcweir &aSdXML_DateStyle_6, 308cdf0e10cSrcweir }; 309cdf0e10cSrcweir 310cdf0e10cSrcweir const SdXMLFixedDataStyle* aSdXMLFixedTimeFormats[SdXMLTimeFormatCount] = 311cdf0e10cSrcweir { 312cdf0e10cSrcweir &aSdXML_TimeStyle_1, 313cdf0e10cSrcweir &aSdXML_TimeStyle_2, 314cdf0e10cSrcweir &aSdXML_TimeStyle_3, 315cdf0e10cSrcweir &aSdXML_TimeStyle_4, 316cdf0e10cSrcweir &aSdXML_TimeStyle_5, 317cdf0e10cSrcweir &aSdXML_TimeStyle_6, 318cdf0e10cSrcweir &aSdXML_TimeStyle_7 319cdf0e10cSrcweir }; 320cdf0e10cSrcweir 321cdf0e10cSrcweir 322cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 323cdf0e10cSrcweir // export 324cdf0e10cSrcweir 325cdf0e10cSrcweir #ifndef SVX_LIGHT 326cdf0e10cSrcweir 327cdf0e10cSrcweir static void SdXMLExportDataStyleNumber( SdXMLExport& rExport, SdXMLDataStyleNumber& rElement ) 328cdf0e10cSrcweir { 329cdf0e10cSrcweir if( rElement.mbDecimal02 ) 330cdf0e10cSrcweir { 331cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_DECIMAL_PLACES, XML_2 ); 332cdf0e10cSrcweir } 333cdf0e10cSrcweir 334cdf0e10cSrcweir if( rElement.mbLong ) 335cdf0e10cSrcweir { 336cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_STYLE, XML_LONG ); 337cdf0e10cSrcweir } 338cdf0e10cSrcweir 339cdf0e10cSrcweir if( rElement.mbTextual ) 340cdf0e10cSrcweir { 341cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_TEXTUAL, XML_TRUE ); 342cdf0e10cSrcweir } 343cdf0e10cSrcweir 344cdf0e10cSrcweir SvXMLElementExport aNumberStyle( rExport, XML_NAMESPACE_NUMBER, rElement.meNumberStyle, sal_True, sal_False ); 345cdf0e10cSrcweir if( rElement.mpText ) 346cdf0e10cSrcweir { 347cdf0e10cSrcweir OUString sAttrValue( OUString::createFromAscii( rElement.mpText ) ); 348cdf0e10cSrcweir rExport.GetDocHandler()->characters( sAttrValue ); 349cdf0e10cSrcweir } 350cdf0e10cSrcweir } 351cdf0e10cSrcweir 352cdf0e10cSrcweir static void SdXMLExportStyle( SdXMLExport& rExport, const SdXMLFixedDataStyle* pStyle, const SdXMLFixedDataStyle* pStyle2 = NULL ) 353cdf0e10cSrcweir { 354cdf0e10cSrcweir OUString sAttrValue; 355cdf0e10cSrcweir 356cdf0e10cSrcweir // name 357cdf0e10cSrcweir sAttrValue = OUString::createFromAscii( pStyle->mpName ); 358cdf0e10cSrcweir if( pStyle2 ) 359cdf0e10cSrcweir sAttrValue += OUString::createFromAscii( pStyle2->mpName ); 360cdf0e10cSrcweir 361cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_NAME, sAttrValue ); 362cdf0e10cSrcweir 363cdf0e10cSrcweir if( pStyle->mbAutomatic ) 364cdf0e10cSrcweir { 365cdf0e10cSrcweir rExport.AddAttribute( XML_NAMESPACE_NUMBER, XML_AUTOMATIC_ORDER, XML_TRUE ); 366cdf0e10cSrcweir } 367cdf0e10cSrcweir 368cdf0e10cSrcweir SvXMLElementExport aElement( rExport, XML_NAMESPACE_NUMBER, pStyle->mbDateStyle ? XML_DATE_STYLE : XML_TIME_STYLE, sal_True, sal_True ); 369cdf0e10cSrcweir 370cdf0e10cSrcweir do 371cdf0e10cSrcweir { 372cdf0e10cSrcweir 373cdf0e10cSrcweir const sal_uInt8* pElements = (const sal_uInt8*)&pStyle->mpFormat[0]; 374cdf0e10cSrcweir 375cdf0e10cSrcweir while( *pElements ) 376cdf0e10cSrcweir { 377cdf0e10cSrcweir SdXMLDataStyleNumber& rElement = aSdXMLDataStyleNumbers[ (*pElements++) - 1 ]; 378cdf0e10cSrcweir SdXMLExportDataStyleNumber( rExport, rElement ); 379cdf0e10cSrcweir } 380cdf0e10cSrcweir 381cdf0e10cSrcweir if( pStyle2 ) 382cdf0e10cSrcweir { 383cdf0e10cSrcweir SdXMLDataStyleNumber& rElement = aSdXMLDataStyleNumbers[ DATA_STYLE_NUMBER_TEXT_SPACE - 1 ]; 384cdf0e10cSrcweir SdXMLExportDataStyleNumber( rExport, rElement ); 385cdf0e10cSrcweir } 386cdf0e10cSrcweir 387cdf0e10cSrcweir pStyle = pStyle2; 388cdf0e10cSrcweir pStyle2 = NULL; 389cdf0e10cSrcweir } 390cdf0e10cSrcweir while( pStyle ); 391cdf0e10cSrcweir } 392cdf0e10cSrcweir 393cdf0e10cSrcweir void SdXMLNumberStylesExporter::exportTimeStyle( SdXMLExport& rExport, sal_Int32 nStyle ) 394cdf0e10cSrcweir { 395cdf0e10cSrcweir DBG_ASSERT( (nStyle >= 0) && (nStyle < SdXMLTimeFormatCount), "Unknown time style!" ); 396cdf0e10cSrcweir if( (nStyle >= 0) && (nStyle < SdXMLTimeFormatCount) ) 397cdf0e10cSrcweir SdXMLExportStyle( rExport, aSdXMLFixedTimeFormats[ nStyle ] ); 398cdf0e10cSrcweir } 399cdf0e10cSrcweir 400cdf0e10cSrcweir void SdXMLNumberStylesExporter::exportDateStyle( SdXMLExport& rExport, sal_Int32 nStyle ) 401cdf0e10cSrcweir { 402cdf0e10cSrcweir if( nStyle > 0x0f ) 403cdf0e10cSrcweir { 404cdf0e10cSrcweir int nDateStyle = nStyle & 0x0f; 405cdf0e10cSrcweir bool bHasDate = nDateStyle != 0; 406cdf0e10cSrcweir 407cdf0e10cSrcweir if( nDateStyle > 1 ) 408cdf0e10cSrcweir nDateStyle -= 2; 409cdf0e10cSrcweir 410cdf0e10cSrcweir DBG_ASSERT( (nDateStyle >= 0) && (nDateStyle < SdXMLDateFormatCount), "unknown date style!" ); 411cdf0e10cSrcweir 412cdf0e10cSrcweir int nTimeStyle = (nStyle >> 4) & 0x0f; 413cdf0e10cSrcweir bool bHasTime = nTimeStyle != 0; 414cdf0e10cSrcweir 415cdf0e10cSrcweir if( nTimeStyle > 1 ) 416cdf0e10cSrcweir nTimeStyle -= 2; 417cdf0e10cSrcweir 418cdf0e10cSrcweir DBG_ASSERT( (nTimeStyle >= 0) && (nTimeStyle < SdXMLTimeFormatCount), "Unknown time style!" ); 419cdf0e10cSrcweir 420cdf0e10cSrcweir if( (nDateStyle >= 0) && (nDateStyle < SdXMLDateFormatCount) && (nTimeStyle >= 0) && (nTimeStyle < SdXMLTimeFormatCount) ) 421cdf0e10cSrcweir { 422cdf0e10cSrcweir if( bHasDate ) 423cdf0e10cSrcweir { 424cdf0e10cSrcweir if( bHasTime ) 425cdf0e10cSrcweir { 426cdf0e10cSrcweir SdXMLExportStyle( rExport, aSdXMLFixedDateFormats[ nDateStyle ], aSdXMLFixedTimeFormats[ nTimeStyle ] ); 427cdf0e10cSrcweir } 428cdf0e10cSrcweir else 429cdf0e10cSrcweir { 430cdf0e10cSrcweir SdXMLExportStyle( rExport, aSdXMLFixedDateFormats[ nDateStyle ] ); 431cdf0e10cSrcweir } 432cdf0e10cSrcweir } 433cdf0e10cSrcweir else if( bHasTime ) 434cdf0e10cSrcweir { 435cdf0e10cSrcweir SdXMLExportStyle( rExport, aSdXMLFixedTimeFormats[ nTimeStyle ] ); 436cdf0e10cSrcweir } 437cdf0e10cSrcweir } 438cdf0e10cSrcweir } 439cdf0e10cSrcweir else 440cdf0e10cSrcweir { 441cdf0e10cSrcweir DBG_ASSERT( (nStyle >= 0) && (nStyle < SdXMLDateFormatCount), "unknown date style!" ); 442cdf0e10cSrcweir if( (nStyle >= 0) && (nStyle < SdXMLDateFormatCount) ) 443cdf0e10cSrcweir SdXMLExportStyle( rExport, aSdXMLFixedDateFormats[ nStyle ] ); 444cdf0e10cSrcweir } 445cdf0e10cSrcweir } 446cdf0e10cSrcweir 447cdf0e10cSrcweir OUString SdXMLNumberStylesExporter::getTimeStyleName(const sal_Int32 nTimeFormat ) 448cdf0e10cSrcweir { 449cdf0e10cSrcweir sal_Int32 nFormat = nTimeFormat; 450cdf0e10cSrcweir if( nFormat > 1 ) 451cdf0e10cSrcweir nFormat -= 2; 452cdf0e10cSrcweir 453cdf0e10cSrcweir if( (nFormat >= 0) && (nFormat < SdXMLTimeFormatCount) ) 454cdf0e10cSrcweir { 455cdf0e10cSrcweir return OUString::createFromAscii(aSdXMLFixedTimeFormats[nFormat]->mpName ); 456cdf0e10cSrcweir } 457cdf0e10cSrcweir else 458cdf0e10cSrcweir { 459cdf0e10cSrcweir return OUString(); 460cdf0e10cSrcweir } 461cdf0e10cSrcweir } 462cdf0e10cSrcweir 463cdf0e10cSrcweir OUString SdXMLNumberStylesExporter::getDateStyleName(const sal_Int32 nDateFormat ) 464cdf0e10cSrcweir { 465cdf0e10cSrcweir sal_Int32 nFormat = nDateFormat; 466cdf0e10cSrcweir 467cdf0e10cSrcweir if( nFormat > 0x0f ) 468cdf0e10cSrcweir { 469cdf0e10cSrcweir OUString aStr; 470cdf0e10cSrcweir if( nFormat & 0x0f ) 471cdf0e10cSrcweir aStr = getDateStyleName( nFormat & 0x0f ); 472cdf0e10cSrcweir aStr += getTimeStyleName( (nFormat >> 4) & 0x0f ); 473cdf0e10cSrcweir return aStr; 474cdf0e10cSrcweir } 475cdf0e10cSrcweir 476cdf0e10cSrcweir if( nFormat > 1 ) 477cdf0e10cSrcweir nFormat -= 2; 478cdf0e10cSrcweir 479cdf0e10cSrcweir if( (nFormat >= 0) && (nFormat < SdXMLDateFormatCount) ) 480cdf0e10cSrcweir { 481cdf0e10cSrcweir return OUString::createFromAscii(aSdXMLFixedDateFormats[nFormat]->mpName ); 482cdf0e10cSrcweir } 483cdf0e10cSrcweir else 484cdf0e10cSrcweir { 485cdf0e10cSrcweir return OUString(); 486cdf0e10cSrcweir } 487cdf0e10cSrcweir } 488cdf0e10cSrcweir 489cdf0e10cSrcweir #endif // #ifndef SVX_LIGHT 490cdf0e10cSrcweir 491cdf0e10cSrcweir 492cdf0e10cSrcweir /////////////////////////////////////////////////////////////////////// 493cdf0e10cSrcweir // import 494cdf0e10cSrcweir 495cdf0e10cSrcweir class SdXMLNumberFormatMemberImportContext : public SvXMLImportContext 496cdf0e10cSrcweir { 497cdf0e10cSrcweir private: 498cdf0e10cSrcweir SdXMLNumberFormatImportContext* mpParent; 499cdf0e10cSrcweir 500cdf0e10cSrcweir OUString maNumberStyle; 501cdf0e10cSrcweir sal_Bool mbLong; 502cdf0e10cSrcweir sal_Bool mbTextual; 503cdf0e10cSrcweir sal_Bool mbDecimal02; 504cdf0e10cSrcweir OUString maText; 505cdf0e10cSrcweir SvXMLImportContext* mpSlaveContext; 506cdf0e10cSrcweir 507cdf0e10cSrcweir public: 508cdf0e10cSrcweir TYPEINFO(); 509cdf0e10cSrcweir 510cdf0e10cSrcweir SdXMLNumberFormatMemberImportContext( SvXMLImport& rImport, 511cdf0e10cSrcweir sal_uInt16 nPrfx, 512cdf0e10cSrcweir const rtl::OUString& rLocalName, 513cdf0e10cSrcweir const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, 514cdf0e10cSrcweir SdXMLNumberFormatImportContext* pParent, 515cdf0e10cSrcweir SvXMLImportContext* pSlaveContext ); 516cdf0e10cSrcweir virtual ~SdXMLNumberFormatMemberImportContext(); 517cdf0e10cSrcweir 518cdf0e10cSrcweir virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix, 519cdf0e10cSrcweir const ::rtl::OUString& rLocalName, 520cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); 521cdf0e10cSrcweir 522cdf0e10cSrcweir virtual void StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ); 523cdf0e10cSrcweir 524cdf0e10cSrcweir virtual void EndElement(); 525cdf0e10cSrcweir 526cdf0e10cSrcweir virtual void Characters( const ::rtl::OUString& rChars ); 527cdf0e10cSrcweir }; 528cdf0e10cSrcweir 529cdf0e10cSrcweir TYPEINIT1( SdXMLNumberFormatMemberImportContext, SvXMLImportContext ); 530cdf0e10cSrcweir 531cdf0e10cSrcweir SdXMLNumberFormatMemberImportContext::SdXMLNumberFormatMemberImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, SdXMLNumberFormatImportContext* pParent, SvXMLImportContext* pSlaveContext ) 532cdf0e10cSrcweir : SvXMLImportContext(rImport, nPrfx, rLocalName), 533cdf0e10cSrcweir mpParent( pParent ), 534cdf0e10cSrcweir maNumberStyle( rLocalName ), 535cdf0e10cSrcweir mpSlaveContext( pSlaveContext ) 536cdf0e10cSrcweir { 537cdf0e10cSrcweir mbLong = sal_False; 538cdf0e10cSrcweir mbTextual = sal_False; 539cdf0e10cSrcweir mbDecimal02 = sal_False; 540cdf0e10cSrcweir 541cdf0e10cSrcweir const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; 542cdf0e10cSrcweir for(sal_Int16 i=0; i < nAttrCount; i++) 543cdf0e10cSrcweir { 544cdf0e10cSrcweir OUString sAttrName = xAttrList->getNameByIndex( i ); 545cdf0e10cSrcweir OUString aLocalName; 546cdf0e10cSrcweir sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); 547cdf0e10cSrcweir OUString sValue = xAttrList->getValueByIndex( i ); 548cdf0e10cSrcweir 549cdf0e10cSrcweir if( nPrefix == XML_NAMESPACE_NUMBER ) 550cdf0e10cSrcweir { 551cdf0e10cSrcweir if( IsXMLToken( aLocalName, XML_DECIMAL_PLACES ) ) 552cdf0e10cSrcweir { 553cdf0e10cSrcweir mbDecimal02 = IsXMLToken( sValue, XML_2 ); 554cdf0e10cSrcweir } 555cdf0e10cSrcweir else if( IsXMLToken( aLocalName, XML_STYLE ) ) 556cdf0e10cSrcweir { 557cdf0e10cSrcweir mbLong = IsXMLToken( sValue, XML_LONG ); 558cdf0e10cSrcweir } 559cdf0e10cSrcweir else if( IsXMLToken( aLocalName, XML_TEXTUAL ) ) 560cdf0e10cSrcweir { 561cdf0e10cSrcweir mbTextual = IsXMLToken( sValue, XML_TRUE ); 562cdf0e10cSrcweir } 563cdf0e10cSrcweir } 564cdf0e10cSrcweir } 565cdf0e10cSrcweir 566cdf0e10cSrcweir } 567cdf0e10cSrcweir 568cdf0e10cSrcweir SdXMLNumberFormatMemberImportContext::~SdXMLNumberFormatMemberImportContext() 569cdf0e10cSrcweir { 570cdf0e10cSrcweir } 571cdf0e10cSrcweir 572cdf0e10cSrcweir SvXMLImportContext *SdXMLNumberFormatMemberImportContext::CreateChildContext( sal_uInt16 nPrefix, 573cdf0e10cSrcweir const ::rtl::OUString& rLocalName, 574cdf0e10cSrcweir const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) 575cdf0e10cSrcweir { 576cdf0e10cSrcweir return mpSlaveContext->CreateChildContext( nPrefix, rLocalName, xAttrList ); 577cdf0e10cSrcweir } 578cdf0e10cSrcweir 579cdf0e10cSrcweir void SdXMLNumberFormatMemberImportContext::StartElement( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList ) 580cdf0e10cSrcweir { 581cdf0e10cSrcweir mpSlaveContext->StartElement( xAttrList ); 582cdf0e10cSrcweir } 583cdf0e10cSrcweir 584cdf0e10cSrcweir void SdXMLNumberFormatMemberImportContext::EndElement() 585cdf0e10cSrcweir { 586cdf0e10cSrcweir mpSlaveContext->EndElement(); 587cdf0e10cSrcweir 588cdf0e10cSrcweir if( mpParent ) 589cdf0e10cSrcweir mpParent->add( maNumberStyle, mbLong, mbTextual, mbDecimal02, maText ); 590cdf0e10cSrcweir } 591cdf0e10cSrcweir 592cdf0e10cSrcweir void SdXMLNumberFormatMemberImportContext::Characters( const ::rtl::OUString& rChars ) 593cdf0e10cSrcweir { 594cdf0e10cSrcweir mpSlaveContext->Characters( rChars ); 595cdf0e10cSrcweir maText += rChars; 596cdf0e10cSrcweir } 597cdf0e10cSrcweir 598cdf0e10cSrcweir TYPEINIT1( SdXMLNumberFormatImportContext, SvXMLImportContext ); 599cdf0e10cSrcweir 600cdf0e10cSrcweir 601cdf0e10cSrcweir SdXMLNumberFormatImportContext::SdXMLNumberFormatImportContext( SdXMLImport& rImport, sal_uInt16 nPrfx, const rtl::OUString& rLocalName, SvXMLNumImpData* pNewData, sal_uInt16 nNewType, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList, SvXMLStylesContext& rStyles) 602cdf0e10cSrcweir : SvXMLNumFormatContext(rImport, nPrfx, rLocalName, pNewData, nNewType, xAttrList, rStyles), 603cdf0e10cSrcweir mrImport( rImport ), 604cdf0e10cSrcweir mbAutomatic( sal_False ), 605cdf0e10cSrcweir mnIndex(0), 606cdf0e10cSrcweir mnKey( -1 ) 607cdf0e10cSrcweir { 608cdf0e10cSrcweir mbTimeStyle = IsXMLToken( rLocalName, XML_TIME_STYLE ); 609cdf0e10cSrcweir 610cdf0e10cSrcweir const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0; 611cdf0e10cSrcweir for(sal_Int16 i=0; i < nAttrCount; i++) 612cdf0e10cSrcweir { 613cdf0e10cSrcweir OUString sAttrName = xAttrList->getNameByIndex( i ); 614cdf0e10cSrcweir OUString aLocalName; 615cdf0e10cSrcweir sal_uInt16 nPrefix = GetImport().GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName ); 616cdf0e10cSrcweir OUString sValue = xAttrList->getValueByIndex( i ); 617cdf0e10cSrcweir 618cdf0e10cSrcweir if( nPrefix == XML_NAMESPACE_NUMBER ) 619cdf0e10cSrcweir { 620cdf0e10cSrcweir if( IsXMLToken( aLocalName, XML_AUTOMATIC_ORDER ) ) 621cdf0e10cSrcweir { 622cdf0e10cSrcweir mbAutomatic = IsXMLToken( sValue, XML_TRUE ); 623cdf0e10cSrcweir } 624cdf0e10cSrcweir } 625cdf0e10cSrcweir } 626cdf0e10cSrcweir } 627cdf0e10cSrcweir 628cdf0e10cSrcweir SdXMLNumberFormatImportContext::~SdXMLNumberFormatImportContext() 629cdf0e10cSrcweir { 630cdf0e10cSrcweir } 631cdf0e10cSrcweir 632cdf0e10cSrcweir void SdXMLNumberFormatImportContext::add( OUString& rNumberStyle, sal_Bool bLong, sal_Bool bTextual, sal_Bool bDecimal02, OUString& rText ) 633cdf0e10cSrcweir { 634cdf0e10cSrcweir if( mnIndex == -1 || mnIndex == 16 ) 635cdf0e10cSrcweir { 636cdf0e10cSrcweir mnIndex = -1; 637cdf0e10cSrcweir return; 638cdf0e10cSrcweir } 639cdf0e10cSrcweir 640cdf0e10cSrcweir const SdXMLDataStyleNumber* pStyleMember = aSdXMLDataStyleNumbers; 641cdf0e10cSrcweir for( sal_uInt8 nIndex = 0; pStyleMember->meNumberStyle != XML_TOKEN_INVALID; nIndex++, pStyleMember++ ) 642cdf0e10cSrcweir { 643cdf0e10cSrcweir if( (IsXMLToken(rNumberStyle, pStyleMember->meNumberStyle) && 644cdf0e10cSrcweir (pStyleMember->mbLong == bLong) && 645cdf0e10cSrcweir (pStyleMember->mbTextual == bTextual) && 646cdf0e10cSrcweir (pStyleMember->mbDecimal02 == bDecimal02) && 647cdf0e10cSrcweir ( ( (pStyleMember->mpText == NULL) && (rText.getLength() == 0) ) || 648cdf0e10cSrcweir ( pStyleMember->mpText && (rText.compareToAscii( pStyleMember->mpText ) == 0 )) ) ) ) 649cdf0e10cSrcweir { 650cdf0e10cSrcweir mnElements[mnIndex++] = nIndex + 1; 651cdf0e10cSrcweir return; 652cdf0e10cSrcweir } 653cdf0e10cSrcweir } 654cdf0e10cSrcweir } 655cdf0e10cSrcweir 656cdf0e10cSrcweir bool SdXMLNumberFormatImportContext::compareStyle( const SdXMLFixedDataStyle* pStyle, sal_Int16& nIndex ) const 657cdf0e10cSrcweir { 658cdf0e10cSrcweir if( (pStyle->mbAutomatic != mbAutomatic) && (nIndex == 0)) 659cdf0e10cSrcweir return sal_False; 660cdf0e10cSrcweir 661cdf0e10cSrcweir sal_Int16 nCompareIndex; 662cdf0e10cSrcweir for( nCompareIndex = 0; nCompareIndex < 8; nIndex++, nCompareIndex++ ) 663cdf0e10cSrcweir { 664cdf0e10cSrcweir if( pStyle->mpFormat[nCompareIndex] != mnElements[nIndex] ) 665cdf0e10cSrcweir return sal_False; 666cdf0e10cSrcweir } 667cdf0e10cSrcweir 668cdf0e10cSrcweir return sal_True; 669cdf0e10cSrcweir } 670cdf0e10cSrcweir 671cdf0e10cSrcweir void SdXMLNumberFormatImportContext::EndElement() 672cdf0e10cSrcweir { 673cdf0e10cSrcweir SvXMLNumFormatContext::EndElement(); 674cdf0e10cSrcweir 675cdf0e10cSrcweir for( ; mnIndex < 16; mnIndex++ ) 676cdf0e10cSrcweir { 677cdf0e10cSrcweir mnElements[mnIndex] = 0; 678cdf0e10cSrcweir } 679cdf0e10cSrcweir 680cdf0e10cSrcweir if( mbTimeStyle ) 681cdf0e10cSrcweir { 682cdf0e10cSrcweir // compare import with all time styles 683cdf0e10cSrcweir for( sal_Int16 nFormat = 0; nFormat < SdXMLTimeFormatCount; nFormat++ ) 684cdf0e10cSrcweir { 685cdf0e10cSrcweir sal_Int16 nIndex = 0; 686cdf0e10cSrcweir if( compareStyle( aSdXMLFixedTimeFormats[nFormat], nIndex ) ) 687cdf0e10cSrcweir { 688cdf0e10cSrcweir mnKey = nFormat + 2; 689cdf0e10cSrcweir break; 690cdf0e10cSrcweir } 691cdf0e10cSrcweir } 692cdf0e10cSrcweir } 693cdf0e10cSrcweir else 694cdf0e10cSrcweir { 695cdf0e10cSrcweir // compare import with all date styles 696cdf0e10cSrcweir for( sal_Int16 nFormat = 0; nFormat < SdXMLDateFormatCount; nFormat++ ) 697cdf0e10cSrcweir { 698cdf0e10cSrcweir sal_Int16 nIndex = 0; 699cdf0e10cSrcweir if( compareStyle( aSdXMLFixedDateFormats[nFormat], nIndex ) ) 700cdf0e10cSrcweir { 701cdf0e10cSrcweir mnKey = nFormat + 2; 702cdf0e10cSrcweir break; 703cdf0e10cSrcweir } 704cdf0e10cSrcweir else if( mnElements[nIndex] == DATA_STYLE_NUMBER_TEXT_SPACE ) 705cdf0e10cSrcweir { 706cdf0e10cSrcweir // if its a valid date ending with a space, see if a time style follows 707cdf0e10cSrcweir for( sal_Int16 nTimeFormat = 0; nTimeFormat < SdXMLTimeFormatCount; nTimeFormat++ ) 708cdf0e10cSrcweir { 709cdf0e10cSrcweir sal_Int16 nIndex2 = nIndex + 1; 710cdf0e10cSrcweir if( compareStyle( aSdXMLFixedTimeFormats[nTimeFormat], nIndex2 ) ) 711cdf0e10cSrcweir { 712cdf0e10cSrcweir mnKey = (nFormat + 2) | ((nTimeFormat + 2) << 4); 713cdf0e10cSrcweir break; 714cdf0e10cSrcweir } 715cdf0e10cSrcweir } 716cdf0e10cSrcweir } 717cdf0e10cSrcweir } 718cdf0e10cSrcweir 719cdf0e10cSrcweir // no date style found? maybe its an extended time style 720cdf0e10cSrcweir if( mnKey == -1 ) 721cdf0e10cSrcweir { 722cdf0e10cSrcweir // compare import with all time styles 723cdf0e10cSrcweir for( sal_Int16 nFormat = 0; nFormat < SdXMLTimeFormatCount; nFormat++ ) 724cdf0e10cSrcweir { 725cdf0e10cSrcweir sal_Int16 nIndex = 0; 726cdf0e10cSrcweir if( compareStyle( aSdXMLFixedTimeFormats[nFormat], nIndex ) ) 727cdf0e10cSrcweir { 728cdf0e10cSrcweir mnKey = (nFormat + 2) << 4; 729cdf0e10cSrcweir break; 730cdf0e10cSrcweir } 731cdf0e10cSrcweir } 732cdf0e10cSrcweir } 733cdf0e10cSrcweir } 734cdf0e10cSrcweir } 735cdf0e10cSrcweir 736cdf0e10cSrcweir SvXMLImportContext * SdXMLNumberFormatImportContext::CreateChildContext( sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList>& xAttrList ) 737cdf0e10cSrcweir { 738cdf0e10cSrcweir return new SdXMLNumberFormatMemberImportContext( GetImport(), nPrefix, rLocalName, xAttrList, this, SvXMLNumFormatContext::CreateChildContext( nPrefix, rLocalName, xAttrList ) ); 739cdf0e10cSrcweir } 740