Bump version to 4.3-4
[LibreOffice.git] / sc / source / filter / xml / xmlimprt.cxx
bloba3fb7d5a274d67794dbd255f135b80a6aae2afa6
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 <svl/zforlist.hxx>
21 #include <sal/macros.h>
23 #include <xmloff/nmspmap.hxx>
24 #include <xmloff/xmlnmspe.hxx>
25 #include <xmloff/i18nmap.hxx>
26 #include <xmloff/xmltkmap.hxx>
27 #include <xmloff/xmlictxt.hxx>
28 #include <xmloff/xmlmetai.hxx>
29 #include <sfx2/objsh.hxx>
30 #include <xmloff/xmlnumfi.hxx>
31 #include <xmloff/xmlscripti.hxx>
32 #include <xmloff/XMLFontStylesContext.hxx>
33 #include <xmloff/DocumentSettingsContext.hxx>
34 #include <xmloff/xmluconv.hxx>
35 #include <xmloff/numehelp.hxx>
36 #include <xmloff/xmltoken.hxx>
37 #include <xmloff/xmlerror.hxx>
39 #include <sax/tools/converter.hxx>
41 #include <svl/zformat.hxx>
42 #include <svl/languageoptions.hxx>
43 #include <editeng/editstat.hxx>
45 #include "appluno.hxx"
46 #include "xmlimprt.hxx"
47 #include "document.hxx"
48 #include "docsh.hxx"
49 #include "docuno.hxx"
50 #include "nameuno.hxx"
51 #include "xmlbodyi.hxx"
52 #include "xmlstyli.hxx"
53 #include "ViewSettingsSequenceDefines.hxx"
55 #include "patattr.hxx"
57 #include "XMLConverter.hxx"
58 #include "XMLTableShapeImportHelper.hxx"
59 #include "XMLChangeTrackingImportHelper.hxx"
60 #include "chgviset.hxx"
61 #include "XMLStylesImportHelper.hxx"
62 #include "sheetdata.hxx"
63 #include "unonames.hxx"
64 #include "rangeutl.hxx"
65 #include "postit.hxx"
66 #include "formulaparserpool.hxx"
67 #include "externalrefmgr.hxx"
68 #include "editutil.hxx"
69 #include "editattributemap.hxx"
70 #include "documentimport.hxx"
71 #include "pivotsource.hxx"
72 #include <unonames.hxx>
74 #include <comphelper/extract.hxx>
76 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
77 #include <com/sun/star/frame/XModel.hpp>
78 #include <com/sun/star/sheet/XSheetCellRange.hpp>
79 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
80 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
81 #include <com/sun/star/util/XMergeable.hpp>
82 #include <com/sun/star/sheet/CellInsertMode.hpp>
83 #include <com/sun/star/sheet/XCellRangeMovement.hpp>
84 #include <com/sun/star/document/XActionLockable.hpp>
85 #include <com/sun/star/util/NumberFormat.hpp>
86 #include <com/sun/star/util/XNumberFormatTypes.hpp>
87 #include <com/sun/star/sheet/XNamedRanges.hpp>
88 #include <com/sun/star/sheet/NamedRangeFlag.hpp>
89 #include <com/sun/star/sheet/XNamedRange.hpp>
90 #include <com/sun/star/sheet/XLabelRanges.hpp>
91 #include <com/sun/star/io/XSeekable.hpp>
92 #include <com/sun/star/beans/XPropertySet.hpp>
94 #include <memory>
96 #define SC_LOCALE "Locale"
97 #define SC_STANDARDFORMAT "StandardFormat"
98 #define SC_CURRENCYSYMBOL "CurrencySymbol"
99 #define SC_REPEAT_COLUMN "repeat-column"
100 #define SC_REPEAT_ROW "repeat-row"
101 #define SC_FILTER "filter"
102 #define SC_PRINT_RANGE "print-range"
104 using namespace com::sun::star;
105 using namespace ::xmloff::token;
106 using namespace ::formula;
107 using ::com::sun::star::uno::Reference;
108 using ::com::sun::star::uno::UNO_QUERY;
110 OUString SAL_CALL ScXMLImport_getImplementationName() throw()
112 return OUString( "com.sun.star.comp.Calc.XMLOasisImporter" );
115 uno::Sequence< OUString > SAL_CALL ScXMLImport_getSupportedServiceNames() throw()
117 const OUString aServiceName( ScXMLImport_getImplementationName() );
118 return uno::Sequence< OUString > ( &aServiceName, 1 );
121 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_createInstance(
122 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
124 // #110680#
125 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_ALL);
126 return (cppu::OWeakObject*)new ScXMLImport( comphelper::getComponentContext(rSMgr), ScXMLImport_getImplementationName(), IMPORT_ALL );
129 OUString SAL_CALL ScXMLImport_Meta_getImplementationName() throw()
131 return OUString( "com.sun.star.comp.Calc.XMLOasisMetaImporter" );
134 uno::Sequence< OUString > SAL_CALL ScXMLImport_Meta_getSupportedServiceNames() throw()
136 const OUString aServiceName( ScXMLImport_Meta_getImplementationName() );
137 return uno::Sequence< OUString > ( &aServiceName, 1 );
140 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Meta_createInstance(
141 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
143 // #110680#
144 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_META);
145 return (cppu::OWeakObject*)new ScXMLImport( comphelper::getComponentContext(rSMgr), ScXMLImport_Meta_getImplementationName(), IMPORT_META );
148 OUString SAL_CALL ScXMLImport_Styles_getImplementationName() throw()
150 return OUString( "com.sun.star.comp.Calc.XMLOasisStylesImporter" );
153 uno::Sequence< OUString > SAL_CALL ScXMLImport_Styles_getSupportedServiceNames() throw()
155 const OUString aServiceName( ScXMLImport_Styles_getImplementationName() );
156 return uno::Sequence< OUString > ( &aServiceName, 1 );
159 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Styles_createInstance(
160 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
162 // #110680#
163 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES|IMPORT_FONTDECLS);
164 return (cppu::OWeakObject*)new ScXMLImport( comphelper::getComponentContext(rSMgr), ScXMLImport_Styles_getImplementationName(), IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES|IMPORT_FONTDECLS);
167 OUString SAL_CALL ScXMLImport_Content_getImplementationName() throw()
169 return OUString( "com.sun.star.comp.Calc.XMLOasisContentImporter" );
172 uno::Sequence< OUString > SAL_CALL ScXMLImport_Content_getSupportedServiceNames() throw()
174 const OUString aServiceName( ScXMLImport_Content_getImplementationName() );
175 return uno::Sequence< OUString > ( &aServiceName, 1 );
178 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Content_createInstance(
179 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
181 // #110680#
182 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_META|IMPORT_STYLES|IMPORT_MASTERSTYLES|IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_SETTINGS|IMPORT_FONTDECLS);
183 return (cppu::OWeakObject*)new ScXMLImport( comphelper::getComponentContext(rSMgr), ScXMLImport_Content_getImplementationName(), IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS);
186 OUString SAL_CALL ScXMLImport_Settings_getImplementationName() throw()
188 return OUString( "com.sun.star.comp.Calc.XMLOasisSettingsImporter" );
191 uno::Sequence< OUString > SAL_CALL ScXMLImport_Settings_getSupportedServiceNames() throw()
193 const OUString aServiceName( ScXMLImport_Settings_getImplementationName() );
194 return uno::Sequence< OUString > ( &aServiceName, 1 );
197 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Settings_createInstance(
198 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
200 // #110680#
201 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_SETTINGS);
202 return (cppu::OWeakObject*)new ScXMLImport( comphelper::getComponentContext(rSMgr), ScXMLImport_Settings_getImplementationName(), IMPORT_SETTINGS );
205 const SvXMLTokenMap& ScXMLImport::GetTableRowCellAttrTokenMap()
207 static const SvXMLTokenMapEntry aTableRowCellAttrTokenMap[] =
209 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_ROW_CELL_ATTR_STYLE_NAME },
210 { XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION_NAME, XML_TOK_TABLE_ROW_CELL_ATTR_CONTENT_VALIDATION_NAME },
211 { XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_ROWS },
212 { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_COLS },
213 { XML_NAMESPACE_TABLE, XML_NUMBER_MATRIX_COLUMNS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_COLS },
214 { XML_NAMESPACE_TABLE, XML_NUMBER_MATRIX_ROWS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_ROWS },
215 { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, XML_TOK_TABLE_ROW_CELL_ATTR_REPEATED },
216 { XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE },
217 { XML_NAMESPACE_CALC_EXT, XML_VALUE_TYPE, XML_TOK_TABLE_ROW_CELL_ATTR_NEW_VALUE_TYPE },
218 { XML_NAMESPACE_OFFICE, XML_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_VALUE },
219 { XML_NAMESPACE_OFFICE, XML_DATE_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_DATE_VALUE },
220 { XML_NAMESPACE_OFFICE, XML_TIME_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_TIME_VALUE },
221 { XML_NAMESPACE_OFFICE, XML_STRING_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_STRING_VALUE },
222 { XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_BOOLEAN_VALUE },
223 { XML_NAMESPACE_TABLE, XML_FORMULA, XML_TOK_TABLE_ROW_CELL_ATTR_FORMULA },
224 { XML_NAMESPACE_OFFICE, XML_CURRENCY, XML_TOK_TABLE_ROW_CELL_ATTR_CURRENCY },
225 XML_TOKEN_MAP_END
228 if ( !pTableRowCellAttrTokenMap )
229 pTableRowCellAttrTokenMap = new SvXMLTokenMap( aTableRowCellAttrTokenMap );
230 return *pTableRowCellAttrTokenMap;
243 // NB: virtually inherit so we can multiply inherit properly
244 // in ScXMLFlatDocContext_Impl
245 class ScXMLDocContext_Impl : public virtual SvXMLImportContext
247 protected:
248 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
250 public:
252 ScXMLDocContext_Impl( ScXMLImport& rImport,
253 sal_uInt16 nPrfx,
254 const OUString& rLName,
255 const uno::Reference<xml::sax::XAttributeList>& xAttrList );
256 virtual ~ScXMLDocContext_Impl();
258 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
259 const OUString& rLocalName,
260 const uno::Reference<xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
263 ScXMLDocContext_Impl::ScXMLDocContext_Impl( ScXMLImport& rImport, sal_uInt16 nPrfx,
264 const OUString& rLName,
265 const uno::Reference<xml::sax::XAttributeList>& /* xAttrList */ ) :
266 SvXMLImportContext( rImport, nPrfx, rLName )
271 ScXMLDocContext_Impl::~ScXMLDocContext_Impl()
275 // context for flat file xml format
276 class ScXMLFlatDocContext_Impl
277 : public ScXMLDocContext_Impl, public SvXMLMetaDocumentContext
279 public:
280 ScXMLFlatDocContext_Impl( ScXMLImport& i_rImport,
281 sal_uInt16 i_nPrefix, const OUString & i_rLName,
282 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
283 const uno::Reference<document::XDocumentProperties>& i_xDocProps);
285 virtual ~ScXMLFlatDocContext_Impl();
287 virtual SvXMLImportContext *CreateChildContext(
288 sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
289 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList) SAL_OVERRIDE;
292 ScXMLFlatDocContext_Impl::ScXMLFlatDocContext_Impl( ScXMLImport& i_rImport,
293 sal_uInt16 i_nPrefix, const OUString & i_rLName,
294 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
295 const uno::Reference<document::XDocumentProperties>& i_xDocProps) :
296 SvXMLImportContext(i_rImport, i_nPrefix, i_rLName),
297 ScXMLDocContext_Impl(i_rImport, i_nPrefix, i_rLName, i_xAttrList),
298 SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName,
299 i_xDocProps)
303 ScXMLFlatDocContext_Impl::~ScXMLFlatDocContext_Impl() { }
306 SvXMLImportContext *ScXMLFlatDocContext_Impl::CreateChildContext(
307 sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
308 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList)
310 // behave like meta base class iff we encounter office:meta
311 const SvXMLTokenMap& rTokenMap = GetScImport().GetDocElemTokenMap();
312 if ( XML_TOK_DOC_META == rTokenMap.Get( i_nPrefix, i_rLocalName ) ) {
313 return SvXMLMetaDocumentContext::CreateChildContext(
314 i_nPrefix, i_rLocalName, i_xAttrList );
315 } else {
316 return ScXMLDocContext_Impl::CreateChildContext(
317 i_nPrefix, i_rLocalName, i_xAttrList );
321 class ScXMLBodyContext_Impl : public SvXMLImportContext
323 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
325 public:
327 ScXMLBodyContext_Impl( ScXMLImport& rImport, sal_uInt16 nPrfx,
328 const OUString& rLName,
329 const uno::Reference< xml::sax::XAttributeList > & xAttrList );
330 virtual ~ScXMLBodyContext_Impl();
332 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
333 const OUString& rLocalName,
334 const uno::Reference< xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
337 ScXMLBodyContext_Impl::ScXMLBodyContext_Impl( ScXMLImport& rImport,
338 sal_uInt16 nPrfx, const OUString& rLName,
339 const uno::Reference< xml::sax::XAttributeList > & /* xAttrList */ ) :
340 SvXMLImportContext( rImport, nPrfx, rLName )
344 ScXMLBodyContext_Impl::~ScXMLBodyContext_Impl()
348 SvXMLImportContext *ScXMLBodyContext_Impl::CreateChildContext(
349 sal_uInt16 /* nPrefix */,
350 const OUString& rLocalName,
351 const uno::Reference< xml::sax::XAttributeList > & xAttrList )
353 return GetScImport().CreateBodyContext( rLocalName, xAttrList );
356 SvXMLImportContext *ScXMLDocContext_Impl::CreateChildContext( sal_uInt16 nPrefix,
357 const OUString& rLocalName,
358 const uno::Reference<xml::sax::XAttributeList>& xAttrList )
360 SvXMLImportContext *pContext(0);
362 const SvXMLTokenMap& rTokenMap(GetScImport().GetDocElemTokenMap());
363 switch( rTokenMap.Get( nPrefix, rLocalName ) )
365 case XML_TOK_DOC_FONTDECLS:
366 if (GetScImport().getImportFlags() & IMPORT_FONTDECLS)
367 pContext = GetScImport().CreateFontDeclsContext(nPrefix, rLocalName, xAttrList);
368 break;
369 case XML_TOK_DOC_STYLES:
370 if (GetScImport().getImportFlags() & IMPORT_STYLES)
371 pContext = GetScImport().CreateStylesContext( rLocalName, xAttrList, false);
372 break;
373 case XML_TOK_DOC_AUTOSTYLES:
374 if (GetScImport().getImportFlags() & IMPORT_AUTOSTYLES)
375 pContext = GetScImport().CreateStylesContext( rLocalName, xAttrList, true);
376 break;
377 case XML_TOK_DOC_MASTERSTYLES:
378 if (GetScImport().getImportFlags() & IMPORT_MASTERSTYLES)
379 pContext = new ScXMLMasterStylesContext( GetImport(), nPrefix, rLocalName,
380 xAttrList );
381 break;
382 case XML_TOK_DOC_META:
383 DBG_WARNING("XML_TOK_DOC_META: should not have come here, maybe document is invalid?");
384 break;
385 case XML_TOK_DOC_SCRIPTS:
386 if (GetScImport().getImportFlags() & IMPORT_SCRIPTS)
387 pContext = GetScImport().CreateScriptContext( rLocalName );
388 break;
389 case XML_TOK_DOC_BODY:
390 if (GetScImport().getImportFlags() & IMPORT_CONTENT)
391 pContext = new ScXMLBodyContext_Impl( GetScImport(), nPrefix,
392 rLocalName, xAttrList );
393 break;
394 case XML_TOK_DOC_SETTINGS:
395 if (GetScImport().getImportFlags() & IMPORT_SETTINGS)
396 pContext = new XMLDocumentSettingsContext(GetScImport(), nPrefix, rLocalName, xAttrList );
397 break;
400 if(!pContext)
401 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
403 return pContext;
406 const SvXMLTokenMap& ScXMLImport::GetDocElemTokenMap()
408 if( !pDocElemTokenMap )
410 static const SvXMLTokenMapEntry aDocTokenMap[] =
412 { XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS, XML_TOK_DOC_FONTDECLS },
413 { XML_NAMESPACE_OFFICE, XML_STYLES, XML_TOK_DOC_STYLES },
414 { XML_NAMESPACE_OFFICE, XML_AUTOMATIC_STYLES, XML_TOK_DOC_AUTOSTYLES },
415 { XML_NAMESPACE_OFFICE, XML_MASTER_STYLES, XML_TOK_DOC_MASTERSTYLES },
416 { XML_NAMESPACE_OFFICE, XML_META, XML_TOK_DOC_META },
417 { XML_NAMESPACE_OFFICE, XML_SCRIPTS, XML_TOK_DOC_SCRIPTS },
418 { XML_NAMESPACE_OFFICE, XML_BODY, XML_TOK_DOC_BODY },
419 { XML_NAMESPACE_OFFICE, XML_SETTINGS, XML_TOK_DOC_SETTINGS },
420 XML_TOKEN_MAP_END
423 pDocElemTokenMap = new SvXMLTokenMap( aDocTokenMap );
425 } // if( !pDocElemTokenMap )
427 return *pDocElemTokenMap;
431 const SvXMLTokenMap& ScXMLImport::GetBodyElemTokenMap()
433 if( !pBodyElemTokenMap )
435 static const SvXMLTokenMapEntry aBodyTokenMap[] =
437 { XML_NAMESPACE_TABLE, XML_TRACKED_CHANGES, XML_TOK_BODY_TRACKED_CHANGES },
438 { XML_NAMESPACE_TABLE, XML_CALCULATION_SETTINGS, XML_TOK_BODY_CALCULATION_SETTINGS },
439 { XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATIONS, XML_TOK_BODY_CONTENT_VALIDATIONS },
440 { XML_NAMESPACE_TABLE, XML_LABEL_RANGES, XML_TOK_BODY_LABEL_RANGES },
441 { XML_NAMESPACE_TABLE, XML_TABLE, XML_TOK_BODY_TABLE },
442 { XML_NAMESPACE_TABLE, XML_NAMED_EXPRESSIONS, XML_TOK_BODY_NAMED_EXPRESSIONS },
443 { XML_NAMESPACE_TABLE, XML_DATABASE_RANGES, XML_TOK_BODY_DATABASE_RANGES },
444 { XML_NAMESPACE_TABLE, XML_DATABASE_RANGE, XML_TOK_BODY_DATABASE_RANGE },
445 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_TABLES, XML_TOK_BODY_DATA_PILOT_TABLES },
446 { XML_NAMESPACE_TABLE, XML_CONSOLIDATION, XML_TOK_BODY_CONSOLIDATION },
447 { XML_NAMESPACE_TABLE, XML_DDE_LINKS, XML_TOK_BODY_DDE_LINKS },
448 { XML_NAMESPACE_CALC_EXT, XML_DATA_STREAM_SOURCE, XML_TOK_BODY_DATA_STREAM_SOURCE },
449 XML_TOKEN_MAP_END
452 pBodyElemTokenMap = new SvXMLTokenMap( aBodyTokenMap );
453 } // if( !pBodyElemTokenMap )
455 return *pBodyElemTokenMap;
458 const SvXMLTokenMap& ScXMLImport::GetContentValidationsElemTokenMap()
460 if( !pContentValidationsElemTokenMap )
462 static const SvXMLTokenMapEntry aContentValidationsElemTokenMap[] =
464 { XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION, XML_TOK_CONTENT_VALIDATION },
465 XML_TOKEN_MAP_END
468 pContentValidationsElemTokenMap = new SvXMLTokenMap( aContentValidationsElemTokenMap );
469 } // if( !pContentValidationsElemTokenMap )
471 return *pContentValidationsElemTokenMap;
474 const SvXMLTokenMap& ScXMLImport::GetContentValidationElemTokenMap()
476 if( !pContentValidationElemTokenMap )
478 static const SvXMLTokenMapEntry aContentValidationElemTokenMap[] =
480 { XML_NAMESPACE_TABLE, XML_HELP_MESSAGE, XML_TOK_CONTENT_VALIDATION_ELEM_HELP_MESSAGE },
481 { XML_NAMESPACE_TABLE, XML_ERROR_MESSAGE, XML_TOK_CONTENT_VALIDATION_ELEM_ERROR_MESSAGE },
482 { XML_NAMESPACE_TABLE, XML_ERROR_MACRO, XML_TOK_CONTENT_VALIDATION_ELEM_ERROR_MACRO },
483 { XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, XML_TOK_CONTENT_VALIDATION_ELEM_EVENT_LISTENERS },
484 XML_TOKEN_MAP_END
487 pContentValidationElemTokenMap = new SvXMLTokenMap( aContentValidationElemTokenMap );
488 } // if( !pContentValidationElemTokenMap )
490 return *pContentValidationElemTokenMap;
493 const SvXMLTokenMap& ScXMLImport::GetContentValidationAttrTokenMap()
495 if( !pContentValidationAttrTokenMap )
497 static const SvXMLTokenMapEntry aContentValidationAttrTokenMap[] =
499 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_CONTENT_VALIDATION_NAME },
500 { XML_NAMESPACE_TABLE, XML_CONDITION, XML_TOK_CONTENT_VALIDATION_CONDITION },
501 { XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, XML_TOK_CONTENT_VALIDATION_BASE_CELL_ADDRESS },
502 { XML_NAMESPACE_TABLE, XML_ALLOW_EMPTY_CELL, XML_TOK_CONTENT_VALIDATION_ALLOW_EMPTY_CELL },
503 { XML_NAMESPACE_TABLE, XML_DISPLAY_LIST, XML_TOK_CONTENT_VALIDATION_DISPLAY_LIST },
504 XML_TOKEN_MAP_END
507 pContentValidationAttrTokenMap = new SvXMLTokenMap( aContentValidationAttrTokenMap );
508 } // if( !pContentValidationAttrTokenMap )
510 return *pContentValidationAttrTokenMap;
513 const SvXMLTokenMap& ScXMLImport::GetContentValidationMessageElemTokenMap()
515 if( !pContentValidationMessageElemTokenMap )
517 static const SvXMLTokenMapEntry aContentValidationMessageElemTokenMap[] =
519 { XML_NAMESPACE_TEXT, XML_P, XML_TOK_P },
520 XML_TOKEN_MAP_END
523 pContentValidationMessageElemTokenMap = new SvXMLTokenMap( aContentValidationMessageElemTokenMap );
524 } // if( !pContentValidationMessageElemTokenMap )
526 return *pContentValidationMessageElemTokenMap;
529 const SvXMLTokenMap& ScXMLImport::GetContentValidationHelpMessageAttrTokenMap()
531 if( !pContentValidationHelpMessageAttrTokenMap )
533 static const SvXMLTokenMapEntry aContentValidationHelpMessageAttrTokenMap[] =
535 { XML_NAMESPACE_TABLE, XML_TITLE, XML_TOK_HELP_MESSAGE_ATTR_TITLE },
536 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_HELP_MESSAGE_ATTR_DISPLAY },
537 XML_TOKEN_MAP_END
540 pContentValidationHelpMessageAttrTokenMap = new SvXMLTokenMap( aContentValidationHelpMessageAttrTokenMap );
541 } // if( !pContentValidationHelpMessageAttrTokenMap )
543 return *pContentValidationHelpMessageAttrTokenMap;
546 const SvXMLTokenMap& ScXMLImport::GetContentValidationErrorMessageAttrTokenMap()
548 if( !pContentValidationErrorMessageAttrTokenMap )
550 static const SvXMLTokenMapEntry aContentValidationErrorMessageAttrTokenMap[] =
552 { XML_NAMESPACE_TABLE, XML_TITLE, XML_TOK_ERROR_MESSAGE_ATTR_TITLE },
553 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_ERROR_MESSAGE_ATTR_DISPLAY },
554 { XML_NAMESPACE_TABLE, XML_MESSAGE_TYPE, XML_TOK_ERROR_MESSAGE_ATTR_MESSAGE_TYPE },
555 XML_TOKEN_MAP_END
558 pContentValidationErrorMessageAttrTokenMap = new SvXMLTokenMap( aContentValidationErrorMessageAttrTokenMap );
559 } // if( !pContentValidationErrorMessageAttrTokenMap )
561 return *pContentValidationErrorMessageAttrTokenMap;
564 const SvXMLTokenMap& ScXMLImport::GetContentValidationErrorMacroAttrTokenMap()
566 if( !pContentValidationErrorMacroAttrTokenMap )
568 static const SvXMLTokenMapEntry aContentValidationErrorMacroAttrTokenMap[] =
570 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_ERROR_MACRO_ATTR_NAME },
571 { XML_NAMESPACE_TABLE, XML_EXECUTE, XML_TOK_ERROR_MACRO_ATTR_EXECUTE },
572 XML_TOKEN_MAP_END
575 pContentValidationErrorMacroAttrTokenMap = new SvXMLTokenMap( aContentValidationErrorMacroAttrTokenMap );
576 } // if( !pContentValidationErrorMacroAttrTokenMap )
578 return *pContentValidationErrorMacroAttrTokenMap;
581 const SvXMLTokenMap& ScXMLImport::GetCondFormatsTokenMap()
583 if( !pCondFormatsTokenMap )
585 static const SvXMLTokenMapEntry aCondFormatsElemTokenMap[] =
587 { XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMAT, XML_TOK_CONDFORMATS_CONDFORMAT },
588 XML_TOKEN_MAP_END
591 pCondFormatsTokenMap = new SvXMLTokenMap( aCondFormatsElemTokenMap );
594 return *pCondFormatsTokenMap;
597 const SvXMLTokenMap& ScXMLImport::GetCondFormatTokenMap()
599 if( !pCondFormatTokenMap )
601 static const SvXMLTokenMapEntry aCondFormatElemTokenMap[] =
603 { XML_NAMESPACE_CALC_EXT, XML_COLOR_SCALE, XML_TOK_CONDFORMAT_COLORSCALE },
604 { XML_NAMESPACE_CALC_EXT, XML_DATA_BAR, XML_TOK_CONDFORMAT_DATABAR },
605 { XML_NAMESPACE_CALC_EXT, XML_CONDITION, XML_TOK_CONDFORMAT_CONDITION },
606 { XML_NAMESPACE_CALC_EXT, XML_ICON_SET, XML_TOK_CONDFORMAT_ICONSET },
607 { XML_NAMESPACE_CALC_EXT, XML_DATE_IS, XML_TOK_CONDFORMAT_DATE },
608 XML_TOKEN_MAP_END
611 pCondFormatTokenMap = new SvXMLTokenMap( aCondFormatElemTokenMap );
614 return *pCondFormatTokenMap;
617 const SvXMLTokenMap& ScXMLImport::GetCondFormatAttrMap()
619 if( !pCondFormatAttrMap )
621 static const SvXMLTokenMapEntry aCondFormatAttrTokenMap[] =
623 { XML_NAMESPACE_CALC_EXT, XML_TARGET_RANGE_ADDRESS, XML_TOK_CONDFORMAT_TARGET_RANGE },
624 XML_TOKEN_MAP_END
627 pCondFormatAttrMap = new SvXMLTokenMap( aCondFormatAttrTokenMap );
630 return *pCondFormatAttrMap;
633 const SvXMLTokenMap& ScXMLImport::GetCondDateAttrMap()
635 if( !pCondDateAttrMap )
637 static const SvXMLTokenMapEntry aCondDateAttrTokenMap[] =
639 { XML_NAMESPACE_CALC_EXT, XML_DATE, XML_TOK_COND_DATE_VALUE },
640 { XML_NAMESPACE_CALC_EXT, XML_STYLE, XML_TOK_COND_DATE_STYLE },
641 XML_TOKEN_MAP_END
644 pCondDateAttrMap = new SvXMLTokenMap( aCondDateAttrTokenMap );
647 return *pCondDateAttrMap;
650 const SvXMLTokenMap& ScXMLImport::GetConditionAttrMap()
652 if( !pConditionAttrMap )
654 static const SvXMLTokenMapEntry aConditionAttrTokenMap[] =
656 { XML_NAMESPACE_CALC_EXT, XML_VALUE, XML_TOK_CONDITION_VALUE },
657 { XML_NAMESPACE_CALC_EXT, XML_APPLY_STYLE_NAME, XML_TOK_CONDITION_APPLY_STYLE_NAME },
658 { XML_NAMESPACE_CALC_EXT, XML_BASE_CELL_ADDRESS, XML_TOK_CONDITION_BASE_CELL_ADDRESS },
659 XML_TOKEN_MAP_END
662 pConditionAttrMap = new SvXMLTokenMap( aConditionAttrTokenMap );
665 return *pConditionAttrMap;
668 const SvXMLTokenMap& ScXMLImport::GetColorScaleTokenMap()
670 if( !pColorScaleTokenMap )
672 static const SvXMLTokenMapEntry aColorScaleElemTokenMap[] =
674 { XML_NAMESPACE_CALC_EXT, XML_COLOR_SCALE_ENTRY, XML_TOK_COLORSCALE_COLORSCALEENTRY },
675 XML_TOKEN_MAP_END
678 pColorScaleTokenMap = new SvXMLTokenMap( aColorScaleElemTokenMap );
681 return *pColorScaleTokenMap;
684 const SvXMLTokenMap& ScXMLImport::GetColorScaleEntryAttrMap()
686 if( !pColorScaleEntryAttrTokenMap )
688 static const SvXMLTokenMapEntry aColorScaleAttrTokenMap[] =
690 { XML_NAMESPACE_CALC_EXT, XML_TYPE, XML_TOK_COLORSCALEENTRY_TYPE },
691 { XML_NAMESPACE_CALC_EXT, XML_VALUE, XML_TOK_COLORSCALEENTRY_VALUE },
692 { XML_NAMESPACE_CALC_EXT, XML_COLOR, XML_TOK_COLORSCALEENTRY_COLOR },
693 XML_TOKEN_MAP_END
696 pColorScaleEntryAttrTokenMap = new SvXMLTokenMap( aColorScaleAttrTokenMap );
699 return *pColorScaleEntryAttrTokenMap;
702 const SvXMLTokenMap& ScXMLImport::GetFormattingTokenMap()
704 if( !pDataBarTokenMap )
706 static const SvXMLTokenMapEntry aDataBarElemTokenMap[] =
708 { XML_NAMESPACE_CALC_EXT, XML_DATA_BAR_ENTRY, XML_TOK_DATABAR_DATABARENTRY },
709 { XML_NAMESPACE_CALC_EXT, XML_FORMATTING_ENTRY, XML_TOK_FORMATTING_ENTRY },
710 XML_TOKEN_MAP_END
713 pDataBarTokenMap = new SvXMLTokenMap( aDataBarElemTokenMap );
716 return *pDataBarTokenMap;
719 const SvXMLTokenMap& ScXMLImport::GetDataBarAttrMap()
721 if( !pDataBarAttrMap )
723 static const SvXMLTokenMapEntry aDataBarAttrTokenMap[] =
725 { XML_NAMESPACE_CALC_EXT, XML_POSITIVE_COLOR, XML_TOK_DATABAR_POSITIVE_COLOR },
726 { XML_NAMESPACE_CALC_EXT, XML_NEGATIVE_COLOR, XML_TOK_DATABAR_NEGATIVE_COLOR },
727 { XML_NAMESPACE_CALC_EXT, XML_GRADIENT, XML_TOK_DATABAR_GRADIENT },
728 { XML_NAMESPACE_CALC_EXT, XML_AXIS_POSITION, XML_TOK_DATABAR_AXISPOSITION },
729 { XML_NAMESPACE_CALC_EXT, XML_SHOW_VALUE, XML_TOK_DATABAR_SHOWVALUE },
730 { XML_NAMESPACE_CALC_EXT, XML_AXIS_COLOR, XML_TOK_DATABAR_AXISCOLOR },
731 XML_TOKEN_MAP_END
734 pDataBarAttrMap = new SvXMLTokenMap( aDataBarAttrTokenMap );
737 return *pDataBarAttrMap;
740 const SvXMLTokenMap& ScXMLImport::GetIconSetAttrMap()
742 if( !pIconSetAttrMap )
744 static const SvXMLTokenMapEntry aIconSetAttrTokenMap[] =
746 { XML_NAMESPACE_CALC_EXT, XML_ICON_SET_TYPE, XML_TOK_ICONSET_TYPE },
747 { XML_NAMESPACE_CALC_EXT, XML_SHOW_VALUE, XML_TOK_ICONSET_SHOWVALUE },
748 XML_TOKEN_MAP_END
751 pIconSetAttrMap = new SvXMLTokenMap( aIconSetAttrTokenMap );
754 return *pIconSetAttrMap;
757 const SvXMLTokenMap& ScXMLImport::GetDataBarEntryAttrMap()
759 if( !pFormattingEntryAttrMap )
761 static const SvXMLTokenMapEntry aDataBarAttrEntryTokenMap[] =
763 { XML_NAMESPACE_CALC_EXT, XML_TYPE, XML_TOK_DATABARENTRY_TYPE },
764 { XML_NAMESPACE_CALC_EXT, XML_VALUE, XML_TOK_DATABARENTRY_VALUE },
765 XML_TOKEN_MAP_END
768 pFormattingEntryAttrMap = new SvXMLTokenMap( aDataBarAttrEntryTokenMap );
771 return *pFormattingEntryAttrMap;
774 const SvXMLTokenMap& ScXMLImport::GetLabelRangesElemTokenMap()
776 if( !pLabelRangesElemTokenMap )
778 static const SvXMLTokenMapEntry aLabelRangesElemTokenMap[] =
780 { XML_NAMESPACE_TABLE, XML_LABEL_RANGE, XML_TOK_LABEL_RANGE_ELEM },
781 XML_TOKEN_MAP_END
784 pLabelRangesElemTokenMap = new SvXMLTokenMap( aLabelRangesElemTokenMap );
785 } // if( !pLabelRangesElemTokenMap )
787 return *pLabelRangesElemTokenMap;
790 const SvXMLTokenMap& ScXMLImport::GetLabelRangeAttrTokenMap()
792 if( !pLabelRangeAttrTokenMap )
794 static const SvXMLTokenMapEntry aLabelRangeAttrTokenMap[] =
796 { XML_NAMESPACE_TABLE, XML_LABEL_CELL_RANGE_ADDRESS, XML_TOK_LABEL_RANGE_ATTR_LABEL_RANGE },
797 { XML_NAMESPACE_TABLE, XML_DATA_CELL_RANGE_ADDRESS, XML_TOK_LABEL_RANGE_ATTR_DATA_RANGE },
798 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_LABEL_RANGE_ATTR_ORIENTATION },
799 XML_TOKEN_MAP_END
802 pLabelRangeAttrTokenMap = new SvXMLTokenMap( aLabelRangeAttrTokenMap );
803 } // if( !pLabelRangeAttrTokenMap )
805 return *pLabelRangeAttrTokenMap;
808 const SvXMLTokenMap& ScXMLImport::GetTableElemTokenMap()
810 if( !pTableElemTokenMap )
812 static const SvXMLTokenMapEntry aTableTokenMap[] =
814 { XML_NAMESPACE_TABLE, XML_NAMED_EXPRESSIONS, XML_TOK_TABLE_NAMED_EXPRESSIONS },
815 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN_GROUP, XML_TOK_TABLE_COL_GROUP },
816 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_COLUMNS, XML_TOK_TABLE_HEADER_COLS },
817 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, XML_TOK_TABLE_COLS },
818 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, XML_TOK_TABLE_COL },
819 { XML_NAMESPACE_TABLE, XML_TABLE_PROTECTION, XML_TOK_TABLE_PROTECTION },
820 { XML_NAMESPACE_LO_EXT, XML_TABLE_PROTECTION, XML_TOK_TABLE_PROTECTION_EXT },
821 { XML_NAMESPACE_OFFICE_EXT, XML_TABLE_PROTECTION, XML_TOK_TABLE_PROTECTION_EXT },
822 { XML_NAMESPACE_TABLE, XML_TABLE_ROW_GROUP, XML_TOK_TABLE_ROW_GROUP },
823 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_ROWS, XML_TOK_TABLE_HEADER_ROWS },
824 { XML_NAMESPACE_TABLE, XML_TABLE_ROWS, XML_TOK_TABLE_ROWS },
825 { XML_NAMESPACE_TABLE, XML_TABLE_ROW, XML_TOK_TABLE_ROW },
826 { XML_NAMESPACE_TABLE, XML_TABLE_SOURCE, XML_TOK_TABLE_SOURCE },
827 { XML_NAMESPACE_TABLE, XML_SCENARIO, XML_TOK_TABLE_SCENARIO },
828 { XML_NAMESPACE_TABLE, XML_SHAPES, XML_TOK_TABLE_SHAPES },
829 { XML_NAMESPACE_OFFICE, XML_FORMS, XML_TOK_TABLE_FORMS },
830 { XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, XML_TOK_TABLE_EVENT_LISTENERS },
831 { XML_NAMESPACE_OFFICE_EXT, XML_EVENT_LISTENERS, XML_TOK_TABLE_EVENT_LISTENERS_EXT },
832 { XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMATS, XML_TOK_TABLE_CONDFORMATS },
833 XML_TOKEN_MAP_END
836 pTableElemTokenMap = new SvXMLTokenMap( aTableTokenMap );
837 } // if( !pTableElemTokenMap )
839 return *pTableElemTokenMap;
842 const SvXMLTokenMap& ScXMLImport::GetTableProtectionAttrTokenMap()
844 if (!pTableProtectionElemTokenMap)
846 static const SvXMLTokenMapEntry aTableProtectionTokenMap[] =
848 { XML_NAMESPACE_TABLE, XML_SELECT_PROTECTED_CELLS, XML_TOK_TABLE_SELECT_PROTECTED_CELLS },
849 { XML_NAMESPACE_TABLE, XML_SELECT_UNPROTECTED_CELLS, XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS },
850 { XML_NAMESPACE_OFFICE_EXT, XML_SELECT_PROTECTED_CELLS, XML_TOK_TABLE_SELECT_PROTECTED_CELLS_EXT },
851 { XML_NAMESPACE_LO_EXT, XML_SELECT_PROTECTED_CELLS, XML_TOK_TABLE_SELECT_PROTECTED_CELLS_EXT },
852 { XML_NAMESPACE_OFFICE_EXT, XML_SELECT_UNPROTECTED_CELLS, XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS_EXT },
853 { XML_NAMESPACE_LO_EXT, XML_SELECT_UNPROTECTED_CELLS, XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS_EXT },
854 XML_TOKEN_MAP_END
856 pTableProtectionElemTokenMap = new SvXMLTokenMap(aTableProtectionTokenMap);
859 return *pTableProtectionElemTokenMap;
862 const SvXMLTokenMap& ScXMLImport::GetTableRowsElemTokenMap()
864 if( !pTableRowsElemTokenMap )
866 static const SvXMLTokenMapEntry aTableRowsElemTokenMap[] =
868 { XML_NAMESPACE_TABLE, XML_TABLE_ROW_GROUP, XML_TOK_TABLE_ROWS_ROW_GROUP },
869 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_ROWS, XML_TOK_TABLE_ROWS_HEADER_ROWS },
870 { XML_NAMESPACE_TABLE, XML_TABLE_ROWS, XML_TOK_TABLE_ROWS_ROWS },
871 { XML_NAMESPACE_TABLE, XML_TABLE_ROW, XML_TOK_TABLE_ROWS_ROW },
872 XML_TOKEN_MAP_END
875 pTableRowsElemTokenMap = new SvXMLTokenMap( aTableRowsElemTokenMap );
876 } // if( !pTableRowsElemTokenMap )
878 return *pTableRowsElemTokenMap;
881 const SvXMLTokenMap& ScXMLImport::GetTableColsElemTokenMap()
883 if( !pTableColsElemTokenMap )
885 static const SvXMLTokenMapEntry aTableColsElemTokenMap[] =
887 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN_GROUP, XML_TOK_TABLE_COLS_COL_GROUP },
888 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_COLUMNS, XML_TOK_TABLE_COLS_HEADER_COLS },
889 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, XML_TOK_TABLE_COLS_COLS },
890 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, XML_TOK_TABLE_COLS_COL },
891 XML_TOKEN_MAP_END
894 pTableColsElemTokenMap = new SvXMLTokenMap( aTableColsElemTokenMap );
895 } // if( !pTableColsElemTokenMap )
897 return *pTableColsElemTokenMap;
900 const SvXMLTokenMap& ScXMLImport::GetTableAttrTokenMap()
902 if( !pTableAttrTokenMap )
904 static const SvXMLTokenMapEntry aTableAttrTokenMap[] =
906 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_TABLE_NAME },
907 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_STYLE_NAME },
908 { XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TOK_TABLE_PROTECTED },
909 { XML_NAMESPACE_TABLE, XML_PRINT_RANGES, XML_TOK_TABLE_PRINT_RANGES },
910 { XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, XML_TOK_TABLE_PASSWORD },
911 { XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM, XML_TOK_TABLE_PASSHASH },
912 { XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2, XML_TOK_TABLE_PASSHASH_2 },
913 { XML_NAMESPACE_LO_EXT, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2, XML_TOK_TABLE_PASSHASH_2 },
914 { XML_NAMESPACE_TABLE, XML_PRINT, XML_TOK_TABLE_PRINT },
915 XML_TOKEN_MAP_END
918 pTableAttrTokenMap = new SvXMLTokenMap( aTableAttrTokenMap );
919 } // if( !pTableAttrTokenMap )
921 return *pTableAttrTokenMap;
924 const SvXMLTokenMap& ScXMLImport::GetTableScenarioAttrTokenMap()
926 if( !pTableScenarioAttrTokenMap )
928 static const SvXMLTokenMapEntry aTableScenarioAttrTokenMap[] =
930 { XML_NAMESPACE_TABLE, XML_DISPLAY_BORDER, XML_TOK_TABLE_SCENARIO_ATTR_DISPLAY_BORDER },
931 { XML_NAMESPACE_TABLE, XML_BORDER_COLOR, XML_TOK_TABLE_SCENARIO_ATTR_BORDER_COLOR },
932 { XML_NAMESPACE_TABLE, XML_COPY_BACK, XML_TOK_TABLE_SCENARIO_ATTR_COPY_BACK },
933 { XML_NAMESPACE_TABLE, XML_COPY_STYLES, XML_TOK_TABLE_SCENARIO_ATTR_COPY_STYLES },
934 { XML_NAMESPACE_TABLE, XML_COPY_FORMULAS, XML_TOK_TABLE_SCENARIO_ATTR_COPY_FORMULAS },
935 { XML_NAMESPACE_TABLE, XML_IS_ACTIVE, XML_TOK_TABLE_SCENARIO_ATTR_IS_ACTIVE },
936 { XML_NAMESPACE_TABLE, XML_SCENARIO_RANGES, XML_TOK_TABLE_SCENARIO_ATTR_SCENARIO_RANGES },
937 { XML_NAMESPACE_TABLE, XML_COMMENT, XML_TOK_TABLE_SCENARIO_ATTR_COMMENT },
938 { XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TOK_TABLE_SCENARIO_ATTR_PROTECTED },
939 XML_TOKEN_MAP_END
942 pTableScenarioAttrTokenMap = new SvXMLTokenMap( aTableScenarioAttrTokenMap );
943 } // if( !pTableScenarioAttrTokenMap )
945 return *pTableScenarioAttrTokenMap;
948 const SvXMLTokenMap& ScXMLImport::GetTableColAttrTokenMap()
950 if( !pTableColAttrTokenMap )
952 static const SvXMLTokenMapEntry aTableColAttrTokenMap[] =
954 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_COL_ATTR_STYLE_NAME },
955 { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, XML_TOK_TABLE_COL_ATTR_REPEATED },
956 { XML_NAMESPACE_TABLE, XML_VISIBILITY, XML_TOK_TABLE_COL_ATTR_VISIBILITY },
957 { XML_NAMESPACE_TABLE, XML_DEFAULT_CELL_STYLE_NAME, XML_TOK_TABLE_COL_ATTR_DEFAULT_CELL_STYLE_NAME },
958 XML_TOKEN_MAP_END
961 pTableColAttrTokenMap = new SvXMLTokenMap( aTableColAttrTokenMap );
962 } // if( !pTableColAttrTokenMap )
964 return *pTableColAttrTokenMap;
967 const SvXMLTokenMap& ScXMLImport::GetTableRowElemTokenMap()
969 if( !pTableRowElemTokenMap )
971 static const SvXMLTokenMapEntry aTableRowTokenMap[] =
973 { XML_NAMESPACE_TABLE, XML_TABLE_CELL, XML_TOK_TABLE_ROW_CELL },
974 { XML_NAMESPACE_TABLE, XML_COVERED_TABLE_CELL, XML_TOK_TABLE_ROW_COVERED_CELL },
975 XML_TOKEN_MAP_END
978 pTableRowElemTokenMap = new SvXMLTokenMap( aTableRowTokenMap );
979 } // if( !pTableRowElemTokenMap )
981 return *pTableRowElemTokenMap;
984 const SvXMLTokenMap& ScXMLImport::GetTableRowAttrTokenMap()
986 if( !pTableRowAttrTokenMap )
988 static const SvXMLTokenMapEntry aTableRowAttrTokenMap[] =
990 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_ROW_ATTR_STYLE_NAME },
991 { XML_NAMESPACE_TABLE, XML_VISIBILITY, XML_TOK_TABLE_ROW_ATTR_VISIBILITY },
992 { XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_REPEATED, XML_TOK_TABLE_ROW_ATTR_REPEATED },
993 { XML_NAMESPACE_TABLE, XML_DEFAULT_CELL_STYLE_NAME, XML_TOK_TABLE_ROW_ATTR_DEFAULT_CELL_STYLE_NAME },
994 // { XML_NAMESPACE_TABLE, XML_USE_OPTIMAL_HEIGHT, XML_TOK_TABLE_ROW_ATTR_USE_OPTIMAL_HEIGHT },
995 XML_TOKEN_MAP_END
998 pTableRowAttrTokenMap = new SvXMLTokenMap( aTableRowAttrTokenMap );
999 } // if( !pTableRowAttrTokenMap )
1001 return *pTableRowAttrTokenMap;
1004 const SvXMLTokenMap& ScXMLImport::GetTableRowCellElemTokenMap()
1006 if( !pTableRowCellElemTokenMap )
1008 static const SvXMLTokenMapEntry aTableRowCellTokenMap[] =
1010 { XML_NAMESPACE_TEXT, XML_P, XML_TOK_TABLE_ROW_CELL_P },
1011 { XML_NAMESPACE_TABLE, XML_SUB_TABLE, XML_TOK_TABLE_ROW_CELL_TABLE },
1012 { XML_NAMESPACE_OFFICE, XML_ANNOTATION, XML_TOK_TABLE_ROW_CELL_ANNOTATION },
1013 { XML_NAMESPACE_TABLE, XML_DETECTIVE, XML_TOK_TABLE_ROW_CELL_DETECTIVE },
1014 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_SOURCE, XML_TOK_TABLE_ROW_CELL_CELL_RANGE_SOURCE },
1015 XML_TOKEN_MAP_END
1018 pTableRowCellElemTokenMap = new SvXMLTokenMap( aTableRowCellTokenMap );
1019 } // if( !pTableRowCellElemTokenMap )
1021 return *pTableRowCellElemTokenMap;
1024 const SvXMLTokenMap& ScXMLImport::GetTableAnnotationAttrTokenMap()
1026 if( !pTableAnnotationAttrTokenMap )
1028 static const SvXMLTokenMapEntry aTableAnnotationAttrTokenMap[] =
1030 { XML_NAMESPACE_OFFICE, XML_AUTHOR, XML_TOK_TABLE_ANNOTATION_ATTR_AUTHOR },
1031 { XML_NAMESPACE_OFFICE, XML_CREATE_DATE, XML_TOK_TABLE_ANNOTATION_ATTR_CREATE_DATE },
1032 { XML_NAMESPACE_OFFICE, XML_CREATE_DATE_STRING, XML_TOK_TABLE_ANNOTATION_ATTR_CREATE_DATE_STRING },
1033 { XML_NAMESPACE_OFFICE, XML_DISPLAY, XML_TOK_TABLE_ANNOTATION_ATTR_DISPLAY },
1034 { XML_NAMESPACE_SVG, XML_X, XML_TOK_TABLE_ANNOTATION_ATTR_X },
1035 { XML_NAMESPACE_SVG, XML_Y, XML_TOK_TABLE_ANNOTATION_ATTR_Y },
1036 XML_TOKEN_MAP_END
1039 pTableAnnotationAttrTokenMap = new SvXMLTokenMap( aTableAnnotationAttrTokenMap );
1040 } // if( !pTableAnnotationAttrTokenMap )
1042 return *pTableAnnotationAttrTokenMap;
1045 const SvXMLTokenMap& ScXMLImport::GetDetectiveElemTokenMap()
1047 if( !pDetectiveElemTokenMap )
1049 static const SvXMLTokenMapEntry aDetectiveElemTokenMap[]=
1051 { XML_NAMESPACE_TABLE, XML_HIGHLIGHTED_RANGE, XML_TOK_DETECTIVE_ELEM_HIGHLIGHTED },
1052 { XML_NAMESPACE_TABLE, XML_OPERATION, XML_TOK_DETECTIVE_ELEM_OPERATION },
1053 XML_TOKEN_MAP_END
1056 pDetectiveElemTokenMap = new SvXMLTokenMap( aDetectiveElemTokenMap );
1057 } // if( !pDetectiveElemTokenMap )
1059 return *pDetectiveElemTokenMap;
1062 const SvXMLTokenMap& ScXMLImport::GetDetectiveHighlightedAttrTokenMap()
1064 if( !pDetectiveHighlightedAttrTokenMap )
1066 static const SvXMLTokenMapEntry aDetectiveHighlightedAttrTokenMap[]=
1068 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_CELL_RANGE },
1069 { XML_NAMESPACE_TABLE, XML_DIRECTION, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_DIRECTION },
1070 { XML_NAMESPACE_TABLE, XML_CONTAINS_ERROR, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_CONTAINS_ERROR },
1071 { XML_NAMESPACE_TABLE, XML_MARKED_INVALID, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_MARKED_INVALID },
1072 XML_TOKEN_MAP_END
1075 pDetectiveHighlightedAttrTokenMap = new SvXMLTokenMap( aDetectiveHighlightedAttrTokenMap );
1076 } // if( !pDetectiveHighlightedAttrTokenMap )
1078 return *pDetectiveHighlightedAttrTokenMap;
1081 const SvXMLTokenMap& ScXMLImport::GetDetectiveOperationAttrTokenMap()
1083 if( !pDetectiveOperationAttrTokenMap )
1085 static const SvXMLTokenMapEntry aDetectiveOperationAttrTokenMap[]=
1087 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DETECTIVE_OPERATION_ATTR_NAME },
1088 { XML_NAMESPACE_TABLE, XML_INDEX, XML_TOK_DETECTIVE_OPERATION_ATTR_INDEX },
1089 XML_TOKEN_MAP_END
1092 pDetectiveOperationAttrTokenMap = new SvXMLTokenMap( aDetectiveOperationAttrTokenMap );
1093 } // if( !pDetectiveOperationAttrTokenMap )
1095 return *pDetectiveOperationAttrTokenMap;
1098 const SvXMLTokenMap& ScXMLImport::GetTableCellRangeSourceAttrTokenMap()
1100 if( !pTableCellRangeSourceAttrTokenMap )
1102 static const SvXMLTokenMapEntry aTableCellRangeSourceAttrTokenMap[] =
1104 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_NAME },
1105 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_HREF },
1106 { XML_NAMESPACE_TABLE, XML_FILTER_NAME, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_NAME },
1107 { XML_NAMESPACE_TABLE, XML_FILTER_OPTIONS, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_OPTIONS },
1108 { XML_NAMESPACE_TABLE, XML_LAST_COLUMN_SPANNED, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_COLUMN },
1109 { XML_NAMESPACE_TABLE, XML_LAST_ROW_SPANNED, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_ROW },
1110 { XML_NAMESPACE_TABLE, XML_REFRESH_DELAY, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_REFRESH_DELAY },
1111 XML_TOKEN_MAP_END
1114 pTableCellRangeSourceAttrTokenMap = new SvXMLTokenMap( aTableCellRangeSourceAttrTokenMap );
1115 } // if( !pTableCellRangeSourceAttrTokenMap )
1117 return *pTableCellRangeSourceAttrTokenMap;
1120 const SvXMLTokenMap& ScXMLImport::GetNamedExpressionsElemTokenMap()
1122 if( !pNamedExpressionsElemTokenMap )
1124 static const SvXMLTokenMapEntry aNamedExpressionsTokenMap[] =
1126 { XML_NAMESPACE_TABLE, XML_NAMED_RANGE, XML_TOK_NAMED_EXPRESSIONS_NAMED_RANGE },
1127 { XML_NAMESPACE_TABLE, XML_NAMED_EXPRESSION, XML_TOK_NAMED_EXPRESSIONS_NAMED_EXPRESSION },
1128 XML_TOKEN_MAP_END
1131 pNamedExpressionsElemTokenMap = new SvXMLTokenMap( aNamedExpressionsTokenMap );
1132 } // if( !pNamedExpressionsElemTokenMap )
1134 return *pNamedExpressionsElemTokenMap;
1137 const SvXMLTokenMap& ScXMLImport::GetNamedRangeAttrTokenMap()
1139 if( !pNamedRangeAttrTokenMap )
1141 static const SvXMLTokenMapEntry aNamedRangeAttrTokenMap[] =
1143 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_NAMED_RANGE_ATTR_NAME },
1144 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, XML_TOK_NAMED_RANGE_ATTR_CELL_RANGE_ADDRESS },
1145 { XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, XML_TOK_NAMED_RANGE_ATTR_BASE_CELL_ADDRESS },
1146 { XML_NAMESPACE_TABLE, XML_RANGE_USABLE_AS, XML_TOK_NAMED_RANGE_ATTR_RANGE_USABLE_AS },
1147 XML_TOKEN_MAP_END
1150 pNamedRangeAttrTokenMap = new SvXMLTokenMap( aNamedRangeAttrTokenMap );
1151 } // if( !pNamedRangeAttrTokenMap )
1153 return *pNamedRangeAttrTokenMap;
1156 const SvXMLTokenMap& ScXMLImport::GetNamedExpressionAttrTokenMap()
1158 if( !pNamedExpressionAttrTokenMap )
1160 static const SvXMLTokenMapEntry aNamedExpressionAttrTokenMap[] =
1162 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_NAMED_EXPRESSION_ATTR_NAME },
1163 { XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, XML_TOK_NAMED_EXPRESSION_ATTR_BASE_CELL_ADDRESS },
1164 { XML_NAMESPACE_TABLE, XML_EXPRESSION, XML_TOK_NAMED_EXPRESSION_ATTR_EXPRESSION },
1165 XML_TOKEN_MAP_END
1168 pNamedExpressionAttrTokenMap = new SvXMLTokenMap( aNamedExpressionAttrTokenMap );
1169 } // if( !pNamedExpressionAttrTokenMap )
1171 return *pNamedExpressionAttrTokenMap;
1174 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangesElemTokenMap()
1176 if( !pDatabaseRangesElemTokenMap )
1178 static const SvXMLTokenMapEntry aDatabaseRangesTokenMap[] =
1180 { XML_NAMESPACE_TABLE, XML_DATABASE_RANGE, XML_TOK_DATABASE_RANGE },
1181 XML_TOKEN_MAP_END
1184 pDatabaseRangesElemTokenMap = new SvXMLTokenMap( aDatabaseRangesTokenMap );
1185 } // if( !pDatabaseRangesElemTokenMap )
1187 return *pDatabaseRangesElemTokenMap;
1190 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeElemTokenMap()
1192 if( !pDatabaseRangeElemTokenMap )
1194 static const SvXMLTokenMapEntry aDatabaseRangeTokenMap[] =
1196 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_SQL, XML_TOK_DATABASE_RANGE_SOURCE_SQL },
1197 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_TABLE, XML_TOK_DATABASE_RANGE_SOURCE_TABLE },
1198 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_QUERY, XML_TOK_DATABASE_RANGE_SOURCE_QUERY },
1199 { XML_NAMESPACE_TABLE, XML_FILTER, XML_TOK_FILTER },
1200 { XML_NAMESPACE_TABLE, XML_SORT, XML_TOK_SORT },
1201 { XML_NAMESPACE_TABLE, XML_SUBTOTAL_RULES, XML_TOK_DATABASE_RANGE_SUBTOTAL_RULES },
1202 XML_TOKEN_MAP_END
1205 pDatabaseRangeElemTokenMap = new SvXMLTokenMap( aDatabaseRangeTokenMap );
1206 } // if( !pDatabaseRangeElemTokenMap )
1208 return *pDatabaseRangeElemTokenMap;
1211 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeAttrTokenMap()
1213 if( !pDatabaseRangeAttrTokenMap )
1215 static const SvXMLTokenMapEntry aDatabaseRangeAttrTokenMap[] =
1217 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DATABASE_RANGE_ATTR_NAME },
1218 { XML_NAMESPACE_TABLE, XML_IS_SELECTION, XML_TOK_DATABASE_RANGE_ATTR_IS_SELECTION },
1219 { XML_NAMESPACE_TABLE, XML_ON_UPDATE_KEEP_STYLES, XML_TOK_DATABASE_RANGE_ATTR_ON_UPDATE_KEEP_STYLES },
1220 { XML_NAMESPACE_TABLE, XML_ON_UPDATE_KEEP_SIZE, XML_TOK_DATABASE_RANGE_ATTR_ON_UPDATE_KEEP_SIZE },
1221 { XML_NAMESPACE_TABLE, XML_HAS_PERSISTENT_DATA, XML_TOK_DATABASE_RANGE_ATTR_HAS_PERSISTENT_DATA },
1222 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_DATABASE_RANGE_ATTR_ORIENTATION },
1223 { XML_NAMESPACE_TABLE, XML_CONTAINS_HEADER, XML_TOK_DATABASE_RANGE_ATTR_CONTAINS_HEADER },
1224 { XML_NAMESPACE_TABLE, XML_DISPLAY_FILTER_BUTTONS, XML_TOK_DATABASE_RANGE_ATTR_DISPLAY_FILTER_BUTTONS },
1225 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_DATABASE_RANGE_ATTR_TARGET_RANGE_ADDRESS },
1226 { XML_NAMESPACE_TABLE, XML_REFRESH_DELAY, XML_TOK_DATABASE_RANGE_ATTR_REFRESH_DELAY },
1227 XML_TOKEN_MAP_END
1230 pDatabaseRangeAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeAttrTokenMap );
1231 } // if( !pDatabaseRangeAttrTokenMap )
1233 return *pDatabaseRangeAttrTokenMap;
1236 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSourceSQLAttrTokenMap()
1238 if( !pDatabaseRangeSourceSQLAttrTokenMap )
1240 static const SvXMLTokenMapEntry aDatabaseRangeSourceSQLAttrTokenMap[] =
1242 { XML_NAMESPACE_TABLE, XML_DATABASE_NAME, XML_TOK_SOURCE_SQL_ATTR_DATABASE_NAME },
1243 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SOURCE_SQL_ATTR_HREF },
1244 { XML_NAMESPACE_TABLE, XML_CONNECTION_RESOURCE, XML_TOK_SOURCE_SQL_ATTR_CONNECTION_RESOURCE},
1245 { XML_NAMESPACE_TABLE, XML_SQL_STATEMENT, XML_TOK_SOURCE_SQL_ATTR_SQL_STATEMENT },
1246 { XML_NAMESPACE_TABLE, XML_PARSE_SQL_STATEMENT, XML_TOK_SOURCE_SQL_ATTR_PARSE_SQL_STATEMENT },
1247 XML_TOKEN_MAP_END
1250 pDatabaseRangeSourceSQLAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSourceSQLAttrTokenMap );
1251 } // if( !pDatabaseRangeSourceSQLAttrTokenMap )
1253 return *pDatabaseRangeSourceSQLAttrTokenMap;
1256 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSourceTableAttrTokenMap()
1258 if( !pDatabaseRangeSourceTableAttrTokenMap )
1260 static const SvXMLTokenMapEntry aDatabaseRangeSourceTableAttrTokenMap[] =
1262 { XML_NAMESPACE_TABLE, XML_DATABASE_NAME, XML_TOK_SOURCE_TABLE_ATTR_DATABASE_NAME },
1263 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SOURCE_TABLE_ATTR_HREF },
1264 { XML_NAMESPACE_TABLE, XML_CONNECTION_RESOURCE, XML_TOK_SOURCE_TABLE_ATTR_CONNECTION_RESOURCE },
1265 { XML_NAMESPACE_TABLE, XML_TABLE_NAME, XML_TOK_SOURCE_TABLE_ATTR_TABLE_NAME },
1266 XML_TOKEN_MAP_END
1269 pDatabaseRangeSourceTableAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSourceTableAttrTokenMap );
1270 } // if( !pDatabaseRangeSourceTableAttrTokenMap )
1272 return *pDatabaseRangeSourceTableAttrTokenMap;
1275 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSourceQueryAttrTokenMap()
1277 if( !pDatabaseRangeSourceQueryAttrTokenMap )
1279 static const SvXMLTokenMapEntry aDatabaseRangeSourceQueryAttrTokenMap[] =
1281 { XML_NAMESPACE_TABLE, XML_DATABASE_NAME, XML_TOK_SOURCE_QUERY_ATTR_DATABASE_NAME },
1282 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SOURCE_QUERY_ATTR_HREF },
1283 { XML_NAMESPACE_TABLE, XML_CONNECTION_RESOURCE, XML_TOK_SOURCE_QUERY_ATTR_CONNECTION_RESOURCE },
1284 { XML_NAMESPACE_TABLE, XML_QUERY_NAME, XML_TOK_SOURCE_QUERY_ATTR_QUERY_NAME },
1285 XML_TOKEN_MAP_END
1288 pDatabaseRangeSourceQueryAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSourceQueryAttrTokenMap );
1289 } // if( !pDatabaseRangeSourceQueryAttrTokenMap )
1291 return *pDatabaseRangeSourceQueryAttrTokenMap;
1294 const SvXMLTokenMap& ScXMLImport::GetFilterElemTokenMap()
1296 if( !pFilterElemTokenMap )
1298 static const SvXMLTokenMapEntry aFilterTokenMap[] =
1300 { XML_NAMESPACE_TABLE, XML_FILTER_AND, XML_TOK_FILTER_AND },
1301 { XML_NAMESPACE_TABLE, XML_FILTER_OR, XML_TOK_FILTER_OR },
1302 { XML_NAMESPACE_TABLE, XML_FILTER_CONDITION, XML_TOK_FILTER_CONDITION },
1303 XML_TOKEN_MAP_END
1306 pFilterElemTokenMap = new SvXMLTokenMap( aFilterTokenMap );
1307 } // if( !pFilterElemTokenMap )
1309 return *pFilterElemTokenMap;
1312 const SvXMLTokenMap& ScXMLImport::GetFilterAttrTokenMap()
1314 if( !pFilterAttrTokenMap )
1316 static const SvXMLTokenMapEntry aFilterAttrTokenMap[] =
1318 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_FILTER_ATTR_TARGET_RANGE_ADDRESS },
1319 { XML_NAMESPACE_TABLE, XML_CONDITION_SOURCE_RANGE_ADDRESS, XML_TOK_FILTER_ATTR_CONDITION_SOURCE_RANGE_ADDRESS },
1320 { XML_NAMESPACE_TABLE, XML_CONDITION_SOURCE, XML_TOK_FILTER_ATTR_CONDITION_SOURCE },
1321 { XML_NAMESPACE_TABLE, XML_DISPLAY_DUPLICATES, XML_TOK_FILTER_ATTR_DISPLAY_DUPLICATES },
1322 XML_TOKEN_MAP_END
1325 pFilterAttrTokenMap = new SvXMLTokenMap( aFilterAttrTokenMap );
1326 } // if( !pFilterAttrTokenMap )
1328 return *pFilterAttrTokenMap;
1331 const SvXMLTokenMap& ScXMLImport::GetFilterConditionElemTokenMap()
1333 if( !pFilterConditionElemTokenMap )
1335 static const SvXMLTokenMapEntry aTokenMap[] =
1337 { XML_NAMESPACE_TABLE, XML_FILTER_SET_ITEM, XML_TOK_CONDITION_FILTER_SET_ITEM },
1338 XML_TOKEN_MAP_END
1341 pFilterConditionElemTokenMap = new SvXMLTokenMap( aTokenMap );
1344 return *pFilterConditionElemTokenMap;
1347 const SvXMLTokenMap& ScXMLImport::GetFilterConditionAttrTokenMap()
1349 if( !pFilterConditionAttrTokenMap )
1351 static const SvXMLTokenMapEntry aFilterConditionAttrTokenMap[] =
1353 { XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, XML_TOK_CONDITION_ATTR_FIELD_NUMBER },
1354 { XML_NAMESPACE_TABLE, XML_CASE_SENSITIVE, XML_TOK_CONDITION_ATTR_CASE_SENSITIVE },
1355 { XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TOK_CONDITION_ATTR_DATA_TYPE },
1356 { XML_NAMESPACE_TABLE, XML_VALUE, XML_TOK_CONDITION_ATTR_VALUE },
1357 { XML_NAMESPACE_TABLE, XML_OPERATOR, XML_TOK_CONDITION_ATTR_OPERATOR },
1358 XML_TOKEN_MAP_END
1361 pFilterConditionAttrTokenMap = new SvXMLTokenMap( aFilterConditionAttrTokenMap );
1362 } // if( !pFilterConditionAttrTokenMap )
1364 return *pFilterConditionAttrTokenMap;
1367 const SvXMLTokenMap& ScXMLImport::GetFilterSetItemAttrTokenMap()
1369 if( !pFilterSetItemAttrTokenMap )
1371 static const SvXMLTokenMapEntry aTokenMap[] =
1373 { XML_NAMESPACE_TABLE, XML_VALUE, XML_TOK_FILTER_SET_ITEM_ATTR_VALUE },
1374 XML_TOKEN_MAP_END
1377 pFilterSetItemAttrTokenMap = new SvXMLTokenMap( aTokenMap );
1380 return *pFilterSetItemAttrTokenMap;
1383 const SvXMLTokenMap& ScXMLImport::GetSortElemTokenMap()
1385 if( !pSortElemTokenMap )
1387 static const SvXMLTokenMapEntry aSortTokenMap[] =
1389 { XML_NAMESPACE_TABLE, XML_SORT_BY, XML_TOK_SORT_SORT_BY },
1390 XML_TOKEN_MAP_END
1393 pSortElemTokenMap = new SvXMLTokenMap( aSortTokenMap );
1394 } // if( !pSortElemTokenMap )
1396 return *pSortElemTokenMap;
1399 const SvXMLTokenMap& ScXMLImport::GetSortAttrTokenMap()
1401 if( !pSortAttrTokenMap )
1403 static const SvXMLTokenMapEntry aSortAttrTokenMap[] =
1405 { XML_NAMESPACE_TABLE, XML_BIND_STYLES_TO_CONTENT, XML_TOK_SORT_ATTR_BIND_STYLES_TO_CONTENT },
1406 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_SORT_ATTR_TARGET_RANGE_ADDRESS },
1407 { XML_NAMESPACE_TABLE, XML_CASE_SENSITIVE, XML_TOK_SORT_ATTR_CASE_SENSITIVE },
1408 { XML_NAMESPACE_TABLE, XML_RFC_LANGUAGE_TAG, XML_TOK_SORT_ATTR_RFC_LANGUAGE_TAG },
1409 { XML_NAMESPACE_TABLE, XML_LANGUAGE, XML_TOK_SORT_ATTR_LANGUAGE },
1410 { XML_NAMESPACE_TABLE, XML_SCRIPT, XML_TOK_SORT_ATTR_SCRIPT },
1411 { XML_NAMESPACE_TABLE, XML_COUNTRY, XML_TOK_SORT_ATTR_COUNTRY },
1412 { XML_NAMESPACE_TABLE, XML_ALGORITHM, XML_TOK_SORT_ATTR_ALGORITHM },
1413 XML_TOKEN_MAP_END
1416 pSortAttrTokenMap = new SvXMLTokenMap( aSortAttrTokenMap );
1417 } // if( !pSortAttrTokenMap )
1419 return *pSortAttrTokenMap;
1422 const SvXMLTokenMap& ScXMLImport::GetSortSortByAttrTokenMap()
1424 if( !pSortSortByAttrTokenMap )
1426 static const SvXMLTokenMapEntry aSortSortByAttrTokenMap[] =
1428 { XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, XML_TOK_SORT_BY_ATTR_FIELD_NUMBER },
1429 { XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TOK_SORT_BY_ATTR_DATA_TYPE },
1430 { XML_NAMESPACE_TABLE, XML_ORDER, XML_TOK_SORT_BY_ATTR_ORDER },
1431 XML_TOKEN_MAP_END
1434 pSortSortByAttrTokenMap = new SvXMLTokenMap( aSortSortByAttrTokenMap );
1435 } // if( !pSortSortByAttrTokenMap )
1437 return *pSortSortByAttrTokenMap;
1440 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSubTotalRulesElemTokenMap()
1442 if( !pDatabaseRangeSubTotalRulesElemTokenMap )
1444 static const SvXMLTokenMapEntry aDatabaseRangeSubTotalRulesTokenMap[] =
1446 { XML_NAMESPACE_TABLE, XML_SORT_GROUPS, XML_TOK_SUBTOTAL_RULES_SORT_GROUPS },
1447 { XML_NAMESPACE_TABLE, XML_SUBTOTAL_RULE, XML_TOK_SUBTOTAL_RULES_SUBTOTAL_RULE },
1448 XML_TOKEN_MAP_END
1451 pDatabaseRangeSubTotalRulesElemTokenMap = new SvXMLTokenMap( aDatabaseRangeSubTotalRulesTokenMap );
1452 } // if( !pDatabaseRangeSubTotalRulesElemTokenMap )
1454 return *pDatabaseRangeSubTotalRulesElemTokenMap;
1457 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSubTotalRulesAttrTokenMap()
1459 if( !pDatabaseRangeSubTotalRulesAttrTokenMap )
1461 static const SvXMLTokenMapEntry aDatabaseRangeSubTotalRulesAttrTokenMap[] =
1463 { XML_NAMESPACE_TABLE, XML_BIND_STYLES_TO_CONTENT, XML_TOK_SUBTOTAL_RULES_ATTR_BIND_STYLES_TO_CONTENT },
1464 { XML_NAMESPACE_TABLE, XML_CASE_SENSITIVE, XML_TOK_SUBTOTAL_RULES_ATTR_CASE_SENSITIVE },
1465 { XML_NAMESPACE_TABLE, XML_PAGE_BREAKS_ON_GROUP_CHANGE, XML_TOK_SUBTOTAL_RULES_ATTR_PAGE_BREAKS_ON_GROUP_CHANGE },
1466 XML_TOKEN_MAP_END
1469 pDatabaseRangeSubTotalRulesAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSubTotalRulesAttrTokenMap );
1470 } // if( !pDatabaseRangeSubTotalRulesAttrTokenMap )
1472 return *pDatabaseRangeSubTotalRulesAttrTokenMap;
1475 const SvXMLTokenMap& ScXMLImport::GetSubTotalRulesSortGroupsAttrTokenMap()
1477 if( !pSubTotalRulesSortGroupsAttrTokenMap )
1479 static const SvXMLTokenMapEntry aSubTotalRulesSortGroupsAttrTokenMap[] =
1481 { XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TOK_SORT_GROUPS_ATTR_DATA_TYPE },
1482 { XML_NAMESPACE_TABLE, XML_ORDER, XML_TOK_SORT_GROUPS_ATTR_ORDER },
1483 XML_TOKEN_MAP_END
1486 pSubTotalRulesSortGroupsAttrTokenMap = new SvXMLTokenMap( aSubTotalRulesSortGroupsAttrTokenMap );
1487 } // if( !pSubTotalRulesSortGroupsAttrTokenMap )
1489 return *pSubTotalRulesSortGroupsAttrTokenMap;
1492 const SvXMLTokenMap& ScXMLImport::GetSubTotalRulesSubTotalRuleElemTokenMap()
1494 if( !pSubTotalRulesSubTotalRuleElemTokenMap )
1496 static const SvXMLTokenMapEntry aSubTotalRulesSubTotalRuleTokenMap[] =
1498 { XML_NAMESPACE_TABLE, XML_SUBTOTAL_FIELD, XML_TOK_SUBTOTAL_RULE_SUBTOTAL_FIELD },
1499 XML_TOKEN_MAP_END
1502 pSubTotalRulesSubTotalRuleElemTokenMap = new SvXMLTokenMap( aSubTotalRulesSubTotalRuleTokenMap );
1503 } // if( !pSubTotalRulesSubTotalRuleElemTokenMap )
1505 return *pSubTotalRulesSubTotalRuleElemTokenMap;
1508 const SvXMLTokenMap& ScXMLImport::GetSubTotalRulesSubTotalRuleAttrTokenMap()
1510 if( !pSubTotalRulesSubTotalRuleAttrTokenMap )
1512 static const SvXMLTokenMapEntry aSubTotalRulesSubTotalRuleAttrTokenMap[] =
1514 { XML_NAMESPACE_TABLE, XML_GROUP_BY_FIELD_NUMBER, XML_TOK_SUBTOTAL_RULE_ATTR_GROUP_BY_FIELD_NUMBER },
1515 XML_TOKEN_MAP_END
1518 pSubTotalRulesSubTotalRuleAttrTokenMap = new SvXMLTokenMap( aSubTotalRulesSubTotalRuleAttrTokenMap );
1519 } // if( !pSubTotalRulesSubTotalRuleAttrTokenMap )
1521 return *pSubTotalRulesSubTotalRuleAttrTokenMap;
1524 const SvXMLTokenMap& ScXMLImport::GetSubTotalRuleSubTotalFieldAttrTokenMap()
1526 if( !pSubTotalRuleSubTotalFieldAttrTokenMap )
1528 static const SvXMLTokenMapEntry aSubTotalRuleSubTotalFieldAttrTokenMap[] =
1530 { XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, XML_TOK_SUBTOTAL_FIELD_ATTR_FIELD_NUMBER },
1531 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_SUBTOTAL_FIELD_ATTR_FUNCTION },
1532 XML_TOKEN_MAP_END
1535 pSubTotalRuleSubTotalFieldAttrTokenMap = new SvXMLTokenMap( aSubTotalRuleSubTotalFieldAttrTokenMap );
1536 } // if( !pSubTotalRuleSubTotalFieldAttrTokenMap )
1538 return *pSubTotalRuleSubTotalFieldAttrTokenMap;
1541 const SvXMLTokenMap& ScXMLImport::GetDataPilotTablesElemTokenMap()
1543 if( !pDataPilotTablesElemTokenMap )
1545 static const SvXMLTokenMapEntry aDataPilotTablesElemTokenMap[] =
1547 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_TABLE, XML_TOK_DATA_PILOT_TABLE },
1548 XML_TOKEN_MAP_END
1551 pDataPilotTablesElemTokenMap = new SvXMLTokenMap( aDataPilotTablesElemTokenMap );
1552 } // if( !pDataPilotTablesElemTokenMap )
1554 return *pDataPilotTablesElemTokenMap;
1557 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableAttrTokenMap()
1559 if( !pDataPilotTableAttrTokenMap )
1561 static const SvXMLTokenMapEntry aDataPilotTableAttrTokenMap[] =
1563 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DATA_PILOT_TABLE_ATTR_NAME },
1564 { XML_NAMESPACE_TABLE, XML_APPLICATION_DATA, XML_TOK_DATA_PILOT_TABLE_ATTR_APPLICATION_DATA },
1565 { XML_NAMESPACE_TABLE, XML_GRAND_TOTAL, XML_TOK_DATA_PILOT_TABLE_ATTR_GRAND_TOTAL },
1566 { XML_NAMESPACE_TABLE, XML_IGNORE_EMPTY_ROWS, XML_TOK_DATA_PILOT_TABLE_ATTR_IGNORE_EMPTY_ROWS },
1567 { XML_NAMESPACE_TABLE, XML_IDENTIFY_CATEGORIES, XML_TOK_DATA_PILOT_TABLE_ATTR_IDENTIFY_CATEGORIES },
1568 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_DATA_PILOT_TABLE_ATTR_TARGET_RANGE_ADDRESS },
1569 { XML_NAMESPACE_TABLE, XML_BUTTONS, XML_TOK_DATA_PILOT_TABLE_ATTR_BUTTONS },
1570 { XML_NAMESPACE_TABLE, XML_SHOW_FILTER_BUTTON, XML_TOK_DATA_PILOT_TABLE_ATTR_SHOW_FILTER_BUTTON },
1571 { XML_NAMESPACE_TABLE, XML_DRILL_DOWN_ON_DOUBLE_CLICK, XML_TOK_DATA_PILOT_TABLE_ATTR_DRILL_DOWN },
1572 { XML_NAMESPACE_TABLE, XML_HEADER_GRID_LAYOUT, XML_TOK_DATA_PILOT_TABLE_ATTR_HEADER_GRID_LAYOUT },
1573 XML_TOKEN_MAP_END
1576 pDataPilotTableAttrTokenMap = new SvXMLTokenMap( aDataPilotTableAttrTokenMap );
1577 } // if( !pDataPilotTableAttrTokenMap )
1579 return *pDataPilotTableAttrTokenMap;
1582 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableElemTokenMap()
1584 if( !pDataPilotTableElemTokenMap )
1586 static const SvXMLTokenMapEntry aDataPilotTableElemTokenMap[] =
1588 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_SQL, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_SQL },
1589 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_TABLE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_TABLE },
1590 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_GRAND_TOTAL, XML_TOK_DATA_PILOT_TABLE_ELEM_GRAND_TOTAL },
1591 { XML_NAMESPACE_TABLE_EXT, XML_DATA_PILOT_GRAND_TOTAL, XML_TOK_DATA_PILOT_TABLE_ELEM_GRAND_TOTAL_EXT },
1592 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_QUERY, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_QUERY },
1593 { XML_NAMESPACE_TABLE, XML_SOURCE_SERVICE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_SERVICE },
1594 { XML_NAMESPACE_TABLE, XML_SOURCE_CELL_RANGE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_CELL_RANGE },
1595 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_FIELD, XML_TOK_DATA_PILOT_TABLE_ELEM_DATA_PILOT_FIELD },
1596 XML_TOKEN_MAP_END
1599 pDataPilotTableElemTokenMap = new SvXMLTokenMap( aDataPilotTableElemTokenMap );
1600 } // if( !pDataPilotTableElemTokenMap )
1602 return *pDataPilotTableElemTokenMap;
1605 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableSourceServiceAttrTokenMap()
1607 if( !pDataPilotTableSourceServiceAttrTokenMap )
1609 static const SvXMLTokenMapEntry aDataPilotTableSourceServiceAttrTokenMap[] =
1611 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_SOURCE_SERVICE_ATTR_NAME },
1612 { XML_NAMESPACE_TABLE, XML_SOURCE_NAME, XML_TOK_SOURCE_SERVICE_ATTR_SOURCE_NAME },
1613 { XML_NAMESPACE_TABLE, XML_OBJECT_NAME, XML_TOK_SOURCE_SERVICE_ATTR_OBJECT_NAME },
1614 { XML_NAMESPACE_TABLE, XML_USER_NAME, XML_TOK_SOURCE_SERVICE_ATTR_USER_NAME },
1615 { XML_NAMESPACE_TABLE, XML_PASSWORD, XML_TOK_SOURCE_SERVICE_ATTR_PASSWORD },
1616 XML_TOKEN_MAP_END
1619 pDataPilotTableSourceServiceAttrTokenMap = new SvXMLTokenMap( aDataPilotTableSourceServiceAttrTokenMap );
1620 } // if( !pDataPilotTableSourceServiceAttrTokenMap )
1622 return *pDataPilotTableSourceServiceAttrTokenMap;
1625 const SvXMLTokenMap& ScXMLImport::GetDataPilotGrandTotalAttrTokenMap()
1627 if (!pDataPilotGrandTotalAttrTokenMap)
1629 static const SvXMLTokenMapEntry aDataPilotGrandTotalAttrTokenMap[] =
1631 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_DATA_PILOT_GRAND_TOTAL_ATTR_DISPLAY },
1632 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_DATA_PILOT_GRAND_TOTAL_ATTR_ORIENTATION },
1633 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_GRAND_TOTAL_ATTR_DISPLAY_NAME },
1634 { XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_GRAND_TOTAL_ATTR_DISPLAY_NAME_EXT },
1635 XML_TOKEN_MAP_END
1638 pDataPilotGrandTotalAttrTokenMap = new SvXMLTokenMap( aDataPilotGrandTotalAttrTokenMap );
1641 return *pDataPilotGrandTotalAttrTokenMap;
1644 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableSourceCellRangeAttrTokenMap()
1646 if( !pDataPilotTableSourceCellRangeAttrTokenMap )
1648 static const SvXMLTokenMapEntry aDataPilotTableSourceCellRangeAttrTokenMap[] =
1650 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, XML_TOK_SOURCE_CELL_RANGE_ATTR_CELL_RANGE_ADDRESS },
1651 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_SOURCE_CELL_RANGE_ATTR_NAME },
1652 XML_TOKEN_MAP_END
1655 pDataPilotTableSourceCellRangeAttrTokenMap = new SvXMLTokenMap( aDataPilotTableSourceCellRangeAttrTokenMap );
1656 } // if( !pDataPilotTableSourceCellRangeAttrTokenMap )
1658 return *pDataPilotTableSourceCellRangeAttrTokenMap;
1661 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableSourceCellRangeElemTokenMap()
1663 if( !pDataPilotTableSourceCellRangeElemTokenMap )
1665 static const SvXMLTokenMapEntry aDataPilotTableSourceCellRangeElemTokenMap[] =
1667 { XML_NAMESPACE_TABLE, XML_FILTER, XML_TOK_SOURCE_CELL_RANGE_ELEM_FILTER},
1668 XML_TOKEN_MAP_END
1671 pDataPilotTableSourceCellRangeElemTokenMap = new SvXMLTokenMap( aDataPilotTableSourceCellRangeElemTokenMap );
1672 } // if( !pDataPilotTableSourceCellRangeElemTokenMap )
1674 return *pDataPilotTableSourceCellRangeElemTokenMap;
1677 const SvXMLTokenMap& ScXMLImport::GetDataPilotFieldAttrTokenMap()
1679 if( !pDataPilotFieldAttrTokenMap )
1681 static const SvXMLTokenMapEntry aDataPilotFieldAttrTokenMap[] =
1683 { XML_NAMESPACE_TABLE, XML_SOURCE_FIELD_NAME, XML_TOK_DATA_PILOT_FIELD_ATTR_SOURCE_FIELD_NAME },
1684 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_FIELD_ATTR_DISPLAY_NAME },
1685 { XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_FIELD_ATTR_DISPLAY_NAME_EXT },
1686 { XML_NAMESPACE_TABLE, XML_IS_DATA_LAYOUT_FIELD, XML_TOK_DATA_PILOT_FIELD_ATTR_IS_DATA_LAYOUT_FIELD },
1687 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_DATA_PILOT_FIELD_ATTR_FUNCTION },
1688 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_DATA_PILOT_FIELD_ATTR_ORIENTATION },
1689 { XML_NAMESPACE_TABLE, XML_SELECTED_PAGE, XML_TOK_DATA_PILOT_FIELD_ATTR_SELECTED_PAGE },
1690 { XML_NAMESPACE_TABLE, XML_USED_HIERARCHY, XML_TOK_DATA_PILOT_FIELD_ATTR_USED_HIERARCHY },
1691 XML_TOKEN_MAP_END
1694 pDataPilotFieldAttrTokenMap = new SvXMLTokenMap( aDataPilotFieldAttrTokenMap );
1695 } // if( !pDataPilotFieldAttrTokenMap )
1697 return *pDataPilotFieldAttrTokenMap;
1700 const SvXMLTokenMap& ScXMLImport::GetDataPilotFieldElemTokenMap()
1702 if( !pDataPilotFieldElemTokenMap )
1704 static const SvXMLTokenMapEntry aDataPilotFieldElemTokenMap[] =
1706 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_LEVEL, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_LEVEL },
1707 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_FIELD_REFERENCE, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_REFERENCE },
1708 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUPS, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_GROUPS },
1709 XML_TOKEN_MAP_END
1712 pDataPilotFieldElemTokenMap = new SvXMLTokenMap( aDataPilotFieldElemTokenMap );
1713 } // if( !pDataPilotFieldElemTokenMap )
1715 return *pDataPilotFieldElemTokenMap;
1718 const SvXMLTokenMap& ScXMLImport::GetDataPilotLevelAttrTokenMap()
1720 if( !pDataPilotLevelAttrTokenMap )
1722 static const SvXMLTokenMapEntry aDataPilotLevelAttrTokenMap[] =
1724 { XML_NAMESPACE_TABLE, XML_SHOW_EMPTY, XML_TOK_DATA_PILOT_LEVEL_ATTR_SHOW_EMPTY },
1725 XML_TOKEN_MAP_END
1728 pDataPilotLevelAttrTokenMap = new SvXMLTokenMap( aDataPilotLevelAttrTokenMap );
1729 } // if( !pDataPilotLevelAttrTokenMap )
1731 return *pDataPilotLevelAttrTokenMap;
1734 const SvXMLTokenMap& ScXMLImport::GetDataPilotLevelElemTokenMap()
1736 if( !pDataPilotLevelElemTokenMap )
1738 static const SvXMLTokenMapEntry aDataPilotLevelElemTokenMap[] =
1740 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_SUBTOTALS, XML_TOK_DATA_PILOT_LEVEL_ELEM_DATA_PILOT_SUBTOTALS },
1741 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_MEMBERS, XML_TOK_DATA_PILOT_LEVEL_ELEM_DATA_PILOT_MEMBERS },
1742 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_DISPLAY_INFO, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_DISPLAY_INFO },
1743 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_SORT_INFO, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_SORT_INFO },
1744 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_LAYOUT_INFO, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_LAYOUT_INFO },
1745 XML_TOKEN_MAP_END
1748 pDataPilotLevelElemTokenMap = new SvXMLTokenMap( aDataPilotLevelElemTokenMap );
1749 } // if( !pDataPilotLevelElemTokenMap )
1751 return *pDataPilotLevelElemTokenMap;
1754 const SvXMLTokenMap& ScXMLImport::GetDataPilotSubTotalsElemTokenMap()
1756 if( !pDataPilotSubTotalsElemTokenMap )
1758 static const SvXMLTokenMapEntry aDataPilotSubTotalsElemTokenMap[] =
1760 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_SUBTOTAL, XML_TOK_DATA_PILOT_SUBTOTALS_ELEM_DATA_PILOT_SUBTOTAL },
1761 XML_TOKEN_MAP_END
1764 pDataPilotSubTotalsElemTokenMap = new SvXMLTokenMap( aDataPilotSubTotalsElemTokenMap );
1765 } // if( !pDataPilotSubTotalsElemTokenMap )
1767 return *pDataPilotSubTotalsElemTokenMap;
1770 const SvXMLTokenMap& ScXMLImport::GetDataPilotSubTotalAttrTokenMap()
1772 if( !pDataPilotSubTotalAttrTokenMap )
1774 static const SvXMLTokenMapEntry aDataPilotSubTotalAttrTokenMap[] =
1776 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_DATA_PILOT_SUBTOTAL_ATTR_FUNCTION },
1777 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_SUBTOTAL_ATTR_DISPLAY_NAME },
1778 { XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_SUBTOTAL_ATTR_DISPLAY_NAME_EXT },
1779 XML_TOKEN_MAP_END
1782 pDataPilotSubTotalAttrTokenMap = new SvXMLTokenMap( aDataPilotSubTotalAttrTokenMap );
1783 } // if( !pDataPilotSubTotalAttrTokenMap )
1785 return *pDataPilotSubTotalAttrTokenMap;
1788 const SvXMLTokenMap& ScXMLImport::GetDataPilotMembersElemTokenMap()
1790 if( !pDataPilotMembersElemTokenMap )
1792 static const SvXMLTokenMapEntry aDataPilotMembersElemTokenMap[] =
1794 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_MEMBER, XML_TOK_DATA_PILOT_MEMBERS_ELEM_DATA_PILOT_MEMBER },
1795 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUP_MEMBER, XML_TOK_DATA_PILOT_MEMBERS_ELEM_DATA_PILOT_MEMBER },
1796 XML_TOKEN_MAP_END
1799 pDataPilotMembersElemTokenMap = new SvXMLTokenMap( aDataPilotMembersElemTokenMap );
1800 } // if( !pDataPilotMembersElemTokenMap )
1802 return *pDataPilotMembersElemTokenMap;
1805 const SvXMLTokenMap& ScXMLImport::GetDataPilotMemberAttrTokenMap()
1807 if( !pDataPilotMemberAttrTokenMap )
1809 static const SvXMLTokenMapEntry aDataPilotMemberAttrTokenMap[] =
1811 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DATA_PILOT_MEMBER_ATTR_NAME },
1812 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_MEMBER_ATTR_DISPLAY_NAME },
1813 { XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_MEMBER_ATTR_DISPLAY_NAME_EXT },
1814 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_DATA_PILOT_MEMBER_ATTR_DISPLAY },
1815 { XML_NAMESPACE_TABLE, XML_SHOW_DETAILS, XML_TOK_DATA_PILOT_MEMBER_ATTR_SHOW_DETAILS },
1816 XML_TOKEN_MAP_END
1819 pDataPilotMemberAttrTokenMap = new SvXMLTokenMap( aDataPilotMemberAttrTokenMap );
1820 } // if( !pDataPilotMemberAttrTokenMap )
1822 return *pDataPilotMemberAttrTokenMap;
1825 const SvXMLTokenMap& ScXMLImport::GetConsolidationAttrTokenMap()
1827 if( !pConsolidationAttrTokenMap )
1829 static const SvXMLTokenMapEntry aConsolidationAttrTokenMap[] =
1831 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_CONSOLIDATION_ATTR_FUNCTION },
1832 { XML_NAMESPACE_TABLE, XML_SOURCE_CELL_RANGE_ADDRESSES, XML_TOK_CONSOLIDATION_ATTR_SOURCE_RANGES },
1833 { XML_NAMESPACE_TABLE, XML_TARGET_CELL_ADDRESS, XML_TOK_CONSOLIDATION_ATTR_TARGET_ADDRESS },
1834 { XML_NAMESPACE_TABLE, XML_USE_LABEL, XML_TOK_CONSOLIDATION_ATTR_USE_LABEL },
1835 { XML_NAMESPACE_TABLE, XML_LINK_TO_SOURCE_DATA, XML_TOK_CONSOLIDATION_ATTR_LINK_TO_SOURCE },
1836 XML_TOKEN_MAP_END
1839 pConsolidationAttrTokenMap = new SvXMLTokenMap( aConsolidationAttrTokenMap );
1840 } // if( !pConsolidationAttrTokenMap )
1842 return *pConsolidationAttrTokenMap;
1845 const SvXMLTokenMap& ScXMLImport::GetCellTextParaElemTokenMap()
1847 if (!pCellTextParaElemTokenMap)
1849 static const SvXMLTokenMapEntry aMap[] =
1851 { XML_NAMESPACE_TEXT, XML_S, XML_TOK_CELL_TEXT_S },
1852 { XML_NAMESPACE_TEXT, XML_SPAN, XML_TOK_CELL_TEXT_SPAN },
1853 { XML_NAMESPACE_TEXT, XML_SHEET_NAME, XML_TOK_CELL_TEXT_SHEET_NAME },
1854 { XML_NAMESPACE_TEXT, XML_DATE, XML_TOK_CELL_TEXT_DATE },
1855 { XML_NAMESPACE_TEXT, XML_TITLE, XML_TOK_CELL_TEXT_TITLE },
1856 { XML_NAMESPACE_TEXT, XML_A, XML_TOK_CELL_TEXT_URL },
1857 XML_TOKEN_MAP_END
1860 pCellTextParaElemTokenMap = new SvXMLTokenMap(aMap);
1862 return *pCellTextParaElemTokenMap;
1865 const SvXMLTokenMap& ScXMLImport::GetCellTextSpanElemTokenMap()
1867 if (!pCellTextSpanElemTokenMap)
1869 static const SvXMLTokenMapEntry aMap[] =
1871 { XML_NAMESPACE_TEXT, XML_SHEET_NAME, XML_TOK_CELL_TEXT_SPAN_ELEM_SHEET_NAME },
1872 { XML_NAMESPACE_TEXT, XML_DATE, XML_TOK_CELL_TEXT_SPAN_ELEM_DATE },
1873 { XML_NAMESPACE_TEXT, XML_TITLE, XML_TOK_CELL_TEXT_SPAN_ELEM_TITLE },
1874 { XML_NAMESPACE_TEXT, XML_A, XML_TOK_CELL_TEXT_SPAN_ELEM_URL },
1875 { XML_NAMESPACE_TEXT, XML_S, XML_TOK_CELL_TEXT_SPAN_ELEM_S },
1876 XML_TOKEN_MAP_END
1879 pCellTextSpanElemTokenMap = new SvXMLTokenMap(aMap);
1881 return *pCellTextSpanElemTokenMap;
1884 const SvXMLTokenMap& ScXMLImport::GetCellTextSpanAttrTokenMap()
1886 if (!pCellTextSpanAttrTokenMap)
1888 static const SvXMLTokenMapEntry aMap[] =
1890 { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_CELL_TEXT_SPAN_ATTR_STYLE_NAME },
1891 XML_TOKEN_MAP_END
1894 pCellTextSpanAttrTokenMap = new SvXMLTokenMap(aMap);
1896 return *pCellTextSpanAttrTokenMap;
1899 const SvXMLTokenMap& ScXMLImport::GetCellTextURLAttrTokenMap()
1901 if (!pCellTextURLAttrTokenMap)
1903 static const SvXMLTokenMapEntry aMap[] =
1905 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_CELL_TEXT_URL_ATTR_UREF },
1906 { XML_NAMESPACE_XLINK, XML_TYPE, XML_TOK_CELL_TEXT_URL_ATTR_TYPE },
1907 XML_TOKEN_MAP_END
1910 pCellTextURLAttrTokenMap = new SvXMLTokenMap(aMap);
1912 return *pCellTextURLAttrTokenMap;
1915 const SvXMLTokenMap& ScXMLImport::GetCellTextSAttrTokenMap()
1917 if (!pCellTextSAttrTokenMap)
1919 static const SvXMLTokenMapEntry aMap[] =
1921 { XML_NAMESPACE_TEXT, XML_C, XML_TOK_CELL_TEXT_S_ATTR_C },
1922 XML_TOKEN_MAP_END
1925 pCellTextSAttrTokenMap = new SvXMLTokenMap(aMap);
1927 return *pCellTextSAttrTokenMap;
1930 const SvXMLTokenMap& ScXMLImport::GetDataStreamAttrTokenMap()
1932 if (!pDataStreamAttrTokenMap)
1934 static const SvXMLTokenMapEntry aMap[] =
1936 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_DATA_STREAM_ATTR_URL },
1937 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_DATA_STREAM_ATTR_RANGE },
1938 { XML_NAMESPACE_CALC_EXT, XML_EMPTY_LINE_REFRESH, XML_TOK_DATA_STREAM_ATTR_EMPTY_LINE_REFRESH },
1939 { XML_NAMESPACE_CALC_EXT, XML_INSERTION_POSITION, XML_TOK_DATA_STREAM_ATTR_INSERTION_POSITION },
1940 XML_TOKEN_MAP_END
1942 pDataStreamAttrTokenMap = new SvXMLTokenMap(aMap);
1944 return *pDataStreamAttrTokenMap;
1947 void ScXMLImport::SetPostProcessData( sc::ImportPostProcessData* p )
1949 mpPostProcessData = p;
1952 sc::ImportPostProcessData* ScXMLImport::GetPostProcessData()
1954 return mpPostProcessData;
1957 sc::PivotTableSources& ScXMLImport::GetPivotTableSources()
1959 if (!mpPivotSources)
1960 mpPivotSources.reset(new sc::PivotTableSources);
1962 return *mpPivotSources;
1965 SvXMLImportContext *ScXMLImport::CreateContext( sal_uInt16 nPrefix,
1966 const OUString& rLocalName,
1967 const uno::Reference<xml::sax::XAttributeList>& xAttrList )
1969 SvXMLImportContext *pContext = 0;
1971 if( (XML_NAMESPACE_OFFICE == nPrefix) &&
1972 ( IsXMLToken(rLocalName, XML_DOCUMENT_STYLES) ||
1973 IsXMLToken(rLocalName, XML_DOCUMENT_CONTENT) ||
1974 IsXMLToken(rLocalName, XML_DOCUMENT_SETTINGS) )) {
1975 pContext = new ScXMLDocContext_Impl( *this, nPrefix, rLocalName,
1976 xAttrList );
1977 } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
1978 ( IsXMLToken(rLocalName, XML_DOCUMENT_META)) ) {
1979 pContext = CreateMetaContext(rLocalName);
1980 } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
1981 ( IsXMLToken(rLocalName, XML_DOCUMENT)) ) {
1982 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1983 GetModel(), uno::UNO_QUERY_THROW);
1984 // flat OpenDocument file format
1985 pContext = new ScXMLFlatDocContext_Impl( *this, nPrefix, rLocalName,
1986 xAttrList, xDPS->getDocumentProperties());
1988 else
1989 pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
1991 return pContext;
1994 ScXMLImport::ScXMLImport(
1995 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > xContext,
1996 OUString const & implementationName, sal_uInt16 nImportFlag)
1997 : SvXMLImport( xContext, implementationName, nImportFlag ),
1998 pDoc( NULL ),
1999 pChangeTrackingImportHelper(NULL),
2000 pStylesImportHelper(NULL),
2001 sNumberFormat(SC_UNONAME_NUMFMT),
2002 sLocale(SC_LOCALE),
2003 sCellStyle(SC_UNONAME_CELLSTYL),
2004 sStandardFormat(SC_STANDARDFORMAT),
2005 sType(SC_UNONAME_TYPE),
2006 pDocElemTokenMap( 0 ),
2007 pStylesElemTokenMap( 0 ),
2008 pStylesAttrTokenMap( 0 ),
2009 pStyleElemTokenMap( 0 ),
2010 pBodyElemTokenMap( 0 ),
2011 pContentValidationsElemTokenMap( 0 ),
2012 pContentValidationElemTokenMap( 0 ),
2013 pContentValidationAttrTokenMap( 0 ),
2014 pContentValidationMessageElemTokenMap( 0 ),
2015 pContentValidationHelpMessageAttrTokenMap( 0 ),
2016 pContentValidationErrorMessageAttrTokenMap( 0 ),
2017 pContentValidationErrorMacroAttrTokenMap( 0 ),
2018 pCondFormatsTokenMap( 0 ),
2019 pCondFormatTokenMap( 0 ),
2020 pCondFormatAttrMap( 0 ),
2021 pCondDateAttrMap( 0 ),
2022 pConditionAttrMap( 0 ),
2023 pColorScaleTokenMap( 0 ),
2024 pColorScaleEntryAttrTokenMap( 0 ),
2025 pDataBarTokenMap( 0 ),
2026 pDataBarAttrMap( 0 ),
2027 pFormattingEntryAttrMap( 0 ),
2028 pIconSetAttrMap( 0 ),
2029 pLabelRangesElemTokenMap( 0 ),
2030 pLabelRangeAttrTokenMap( 0 ),
2031 pTableElemTokenMap( 0 ),
2032 pTableProtectionElemTokenMap(NULL),
2033 pTableRowsElemTokenMap( 0 ),
2034 pTableColsElemTokenMap( 0 ),
2035 pTableScenarioAttrTokenMap( 0 ),
2036 pTableAttrTokenMap( 0 ),
2037 pTableColAttrTokenMap( 0 ),
2038 pTableRowElemTokenMap( 0 ),
2039 pTableRowAttrTokenMap( 0 ),
2040 pTableRowCellElemTokenMap( 0 ),
2041 pTableRowCellAttrTokenMap( 0 ),
2042 pTableAnnotationAttrTokenMap( 0 ),
2043 pDetectiveElemTokenMap( 0 ),
2044 pDetectiveHighlightedAttrTokenMap( 0 ),
2045 pDetectiveOperationAttrTokenMap( 0 ),
2046 pTableCellRangeSourceAttrTokenMap( 0 ),
2047 pNamedExpressionsElemTokenMap( 0 ),
2048 pNamedRangeAttrTokenMap( 0 ),
2049 pNamedExpressionAttrTokenMap( 0 ),
2050 pDatabaseRangesElemTokenMap( 0 ),
2051 pDatabaseRangeElemTokenMap( 0 ),
2052 pDatabaseRangeAttrTokenMap( 0 ),
2053 pDatabaseRangeSourceSQLAttrTokenMap( 0 ),
2054 pDatabaseRangeSourceTableAttrTokenMap( 0 ),
2055 pDatabaseRangeSourceQueryAttrTokenMap( 0 ),
2056 pFilterElemTokenMap( 0 ),
2057 pFilterAttrTokenMap( 0 ),
2058 pFilterConditionElemTokenMap( 0 ),
2059 pFilterConditionAttrTokenMap( 0 ),
2060 pFilterSetItemAttrTokenMap( 0 ),
2061 pSortElemTokenMap( 0 ),
2062 pSortAttrTokenMap( 0 ),
2063 pSortSortByAttrTokenMap( 0 ),
2064 pDatabaseRangeSubTotalRulesElemTokenMap( 0 ),
2065 pDatabaseRangeSubTotalRulesAttrTokenMap( 0 ),
2066 pSubTotalRulesSortGroupsAttrTokenMap( 0 ),
2067 pSubTotalRulesSubTotalRuleElemTokenMap( 0 ),
2068 pSubTotalRulesSubTotalRuleAttrTokenMap( 0 ),
2069 pSubTotalRuleSubTotalFieldAttrTokenMap( 0 ),
2070 pDataPilotTablesElemTokenMap( 0 ),
2071 pDataPilotTableAttrTokenMap( 0 ),
2072 pDataPilotTableElemTokenMap( 0 ),
2073 pDataPilotTableSourceServiceAttrTokenMap( 0 ),
2074 pDataPilotGrandTotalAttrTokenMap(NULL),
2075 pDataPilotTableSourceCellRangeElemTokenMap( 0 ),
2076 pDataPilotTableSourceCellRangeAttrTokenMap( 0 ),
2077 pDataPilotFieldAttrTokenMap( 0 ),
2078 pDataPilotFieldElemTokenMap( 0 ),
2079 pDataPilotLevelAttrTokenMap( 0 ),
2080 pDataPilotLevelElemTokenMap( 0 ),
2081 pDataPilotSubTotalsElemTokenMap( 0 ),
2082 pDataPilotSubTotalAttrTokenMap( 0 ),
2083 pDataPilotMembersElemTokenMap( 0 ),
2084 pDataPilotMemberAttrTokenMap( 0 ),
2085 pConsolidationAttrTokenMap( 0 ),
2086 pCellTextParaElemTokenMap(NULL),
2087 pCellTextSpanElemTokenMap(NULL),
2088 pCellTextSpanAttrTokenMap(NULL),
2089 pCellTextURLAttrTokenMap(NULL),
2090 pCellTextSAttrTokenMap(NULL),
2091 pDataStreamAttrTokenMap(NULL),
2092 mpPostProcessData(NULL),
2093 aTables(*this),
2094 pMyNamedExpressions(NULL),
2095 pMyLabelRanges(NULL),
2096 pValidations(NULL),
2097 pDetectiveOpArray(NULL),
2098 pSolarMutexGuard(NULL),
2099 pNumberFormatAttributesExportHelper(NULL),
2100 pStyleNumberFormats(NULL),
2101 sPrevStyleName(),
2102 sPrevCurrency(),
2103 nSolarMutexLocked(0),
2104 nProgressCount(0),
2105 nStyleFamilyMask( 0 ),
2106 nPrevCellType(0),
2107 bLoadDoc( true ),
2108 bRemoveLastChar(false),
2109 bNullDateSetted(false),
2110 bSelfImportingXMLSet(false),
2111 mbLockSolarMutex(true),
2112 mbImportStyles(true),
2113 mbHasNewCondFormatData(false)
2115 pStylesImportHelper = new ScMyStylesImportHelper(*this);
2117 xScPropHdlFactory = new XMLScPropHdlFactory;
2118 xCellStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScCellStylesProperties, xScPropHdlFactory, false);
2119 xColumnStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScColumnStylesProperties, xScPropHdlFactory, false);
2120 xRowStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScRowStylesImportProperties, xScPropHdlFactory, false);
2121 xTableStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScTableStylesImportProperties, xScPropHdlFactory, false);
2123 // #i66550# needed for 'presentation:event-listener' element for URLs in shapes
2124 GetNamespaceMap().Add(
2125 GetXMLToken( XML_NP_PRESENTATION ),
2126 GetXMLToken( XML_N_PRESENTATION ),
2127 XML_NAMESPACE_PRESENTATION );
2129 // initialize cell type map.
2130 const struct { XMLTokenEnum _token; sal_Int16 _type; } aCellTypePairs[] =
2132 { XML_FLOAT, util::NumberFormat::NUMBER },
2133 { XML_STRING, util::NumberFormat::TEXT },
2134 { XML_TIME, util::NumberFormat::TIME },
2135 { XML_DATE, util::NumberFormat::DATETIME },
2136 { XML_PERCENTAGE, util::NumberFormat::PERCENT },
2137 { XML_CURRENCY, util::NumberFormat::CURRENCY },
2138 { XML_BOOLEAN, util::NumberFormat::LOGICAL }
2140 size_t n = sizeof(aCellTypePairs)/sizeof(aCellTypePairs[0]);
2141 for (size_t i = 0; i < n; ++i)
2143 aCellTypeMap.insert(
2144 CellTypeMap::value_type(
2145 GetXMLToken(aCellTypePairs[i]._token), aCellTypePairs[i]._type));
2149 ScXMLImport::~ScXMLImport() throw()
2151 // delete pI18NMap;
2152 delete pDocElemTokenMap;
2153 delete pStylesElemTokenMap;
2154 delete pStylesAttrTokenMap;
2155 delete pStyleElemTokenMap;
2156 delete pBodyElemTokenMap;
2157 delete pContentValidationsElemTokenMap;
2158 delete pContentValidationElemTokenMap;
2159 delete pContentValidationAttrTokenMap;
2160 delete pContentValidationMessageElemTokenMap;
2161 delete pContentValidationHelpMessageAttrTokenMap;
2162 delete pContentValidationErrorMessageAttrTokenMap;
2163 delete pContentValidationErrorMacroAttrTokenMap;
2164 delete pCondFormatsTokenMap;
2165 delete pCondFormatTokenMap;
2166 delete pCondFormatAttrMap;
2167 delete pCondDateAttrMap;
2168 delete pConditionAttrMap;
2169 delete pColorScaleTokenMap;
2170 delete pColorScaleEntryAttrTokenMap;
2171 delete pDataBarTokenMap;
2172 delete pDataBarAttrMap;
2173 delete pFormattingEntryAttrMap;
2174 delete pLabelRangesElemTokenMap;
2175 delete pLabelRangeAttrTokenMap;
2176 delete pTableElemTokenMap;
2177 delete pTableProtectionElemTokenMap;
2178 delete pTableRowsElemTokenMap;
2179 delete pTableColsElemTokenMap;
2180 delete pTableAttrTokenMap;
2181 delete pTableScenarioAttrTokenMap;
2182 delete pTableColAttrTokenMap;
2183 delete pTableRowElemTokenMap;
2184 delete pTableRowAttrTokenMap;
2185 delete pTableRowCellElemTokenMap;
2186 delete pTableRowCellAttrTokenMap;
2187 delete pTableAnnotationAttrTokenMap;
2188 delete pDetectiveElemTokenMap;
2189 delete pDetectiveHighlightedAttrTokenMap;
2190 delete pDetectiveOperationAttrTokenMap;
2191 delete pTableCellRangeSourceAttrTokenMap;
2192 delete pNamedExpressionsElemTokenMap;
2193 delete pNamedRangeAttrTokenMap;
2194 delete pNamedExpressionAttrTokenMap;
2195 delete pDatabaseRangesElemTokenMap;
2196 delete pDatabaseRangeElemTokenMap;
2197 delete pDatabaseRangeAttrTokenMap;
2198 delete pDatabaseRangeSourceSQLAttrTokenMap;
2199 delete pDatabaseRangeSourceTableAttrTokenMap;
2200 delete pDatabaseRangeSourceQueryAttrTokenMap;
2201 delete pFilterElemTokenMap;
2202 delete pFilterAttrTokenMap;
2203 delete pFilterConditionElemTokenMap;
2204 delete pFilterConditionAttrTokenMap;
2205 delete pFilterSetItemAttrTokenMap;
2206 delete pSortElemTokenMap;
2207 delete pSortAttrTokenMap;
2208 delete pSortSortByAttrTokenMap;
2209 delete pDatabaseRangeSubTotalRulesElemTokenMap;
2210 delete pDatabaseRangeSubTotalRulesAttrTokenMap;
2211 delete pSubTotalRulesSortGroupsAttrTokenMap;
2212 delete pSubTotalRulesSubTotalRuleElemTokenMap;
2213 delete pSubTotalRulesSubTotalRuleAttrTokenMap;
2214 delete pSubTotalRuleSubTotalFieldAttrTokenMap;
2215 delete pDataPilotTablesElemTokenMap;
2216 delete pDataPilotTableAttrTokenMap;
2217 delete pDataPilotTableElemTokenMap;
2218 delete pDataPilotTableSourceServiceAttrTokenMap;
2219 delete pDataPilotTableSourceCellRangeAttrTokenMap;
2220 delete pDataPilotTableSourceCellRangeElemTokenMap;
2221 delete pDataPilotFieldAttrTokenMap;
2222 delete pDataPilotFieldElemTokenMap;
2223 delete pDataPilotLevelAttrTokenMap;
2224 delete pDataPilotLevelElemTokenMap;
2225 delete pDataPilotSubTotalsElemTokenMap;
2226 delete pDataPilotSubTotalAttrTokenMap;
2227 delete pDataPilotMembersElemTokenMap;
2228 delete pDataPilotMemberAttrTokenMap;
2229 delete pConsolidationAttrTokenMap;
2230 delete pCellTextParaElemTokenMap;
2231 delete pCellTextSpanElemTokenMap;
2232 delete pCellTextSpanAttrTokenMap;
2233 delete pCellTextURLAttrTokenMap;
2234 delete pCellTextSAttrTokenMap;
2235 delete pDataStreamAttrTokenMap;
2237 delete pChangeTrackingImportHelper;
2238 delete pNumberFormatAttributesExportHelper;
2239 delete pStyleNumberFormats;
2240 delete pStylesImportHelper;
2242 delete pSolarMutexGuard;
2244 delete pMyNamedExpressions;
2245 delete pMyLabelRanges;
2246 delete pValidations;
2247 delete pDetectiveOpArray;
2250 void ScXMLImport::initialize( const css::uno::Sequence<css::uno::Any>& aArguments )
2251 throw (css::uno::Exception, css::uno::RuntimeException, std::exception)
2253 SvXMLImport::initialize(aArguments);
2255 uno::Reference<beans::XPropertySet> xInfoSet = getImportInfo();
2256 if (!xInfoSet.is())
2257 return;
2259 uno::Reference<beans::XPropertySetInfo> xInfoSetInfo = xInfoSet->getPropertySetInfo();
2260 if (!xInfoSetInfo.is())
2261 return;
2263 if (xInfoSetInfo->hasPropertyByName(SC_UNO_ODS_LOCK_SOLAR_MUTEX))
2264 xInfoSet->getPropertyValue(SC_UNO_ODS_LOCK_SOLAR_MUTEX) >>= mbLockSolarMutex;
2266 if (xInfoSetInfo->hasPropertyByName(SC_UNO_ODS_IMPORT_STYLES))
2267 xInfoSet->getPropertyValue(SC_UNO_ODS_IMPORT_STYLES) >>= mbImportStyles;
2270 SvXMLImportContext *ScXMLImport::CreateFontDeclsContext(const sal_uInt16 nPrefix, const OUString& rLocalName,
2271 const uno::Reference<xml::sax::XAttributeList>& xAttrList)
2273 XMLFontStylesContext *pFSContext = new XMLFontStylesContext(
2274 *this, nPrefix, rLocalName, xAttrList, osl_getThreadTextEncoding());
2275 SetFontDecls(pFSContext);
2276 SvXMLImportContext* pContext = pFSContext;
2277 return pContext;
2280 SvXMLImportContext *ScXMLImport::CreateStylesContext(const OUString& rLocalName,
2281 const uno::Reference<xml::sax::XAttributeList>& xAttrList, bool bIsAutoStyle )
2283 SvXMLImportContext* pContext = new XMLTableStylesContext(
2284 *this, XML_NAMESPACE_OFFICE, rLocalName, xAttrList, bIsAutoStyle);
2286 if (bIsAutoStyle)
2287 SetAutoStyles((SvXMLStylesContext*)pContext);
2288 else
2289 SetStyles((SvXMLStylesContext*)pContext);
2291 return pContext;
2294 SvXMLImportContext *ScXMLImport::CreateBodyContext(const OUString& rLocalName,
2295 const uno::Reference<xml::sax::XAttributeList>& xAttrList)
2297 return new ScXMLBodyContext(*this, XML_NAMESPACE_OFFICE, rLocalName, xAttrList);
2300 SvXMLImportContext *ScXMLImport::CreateMetaContext(
2301 const OUString& rLocalName )
2303 SvXMLImportContext* pContext = NULL;
2305 if (getImportFlags() & IMPORT_META)
2307 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
2308 GetModel(), uno::UNO_QUERY_THROW);
2309 uno::Reference<document::XDocumentProperties> const xDocProps(
2310 (IsStylesOnlyMode()) ? 0 : xDPS->getDocumentProperties());
2311 pContext = new SvXMLMetaDocumentContext(*this,
2312 XML_NAMESPACE_OFFICE, rLocalName,
2313 xDocProps);
2316 if( !pContext )
2317 pContext = new SvXMLImportContext( *this,
2318 XML_NAMESPACE_OFFICE, rLocalName );
2320 return pContext;
2323 SvXMLImportContext *ScXMLImport::CreateScriptContext(
2324 const OUString& rLocalName )
2326 SvXMLImportContext* pContext = NULL;
2328 if( !(IsStylesOnlyMode()) )
2330 pContext = new XMLScriptContext( *this,
2331 XML_NAMESPACE_OFFICE, rLocalName,
2332 GetModel() );
2335 if( !pContext )
2336 pContext = new SvXMLImportContext( *this, XML_NAMESPACE_OFFICE,
2337 rLocalName );
2339 return pContext;
2342 void ScXMLImport::SetStatistics(
2343 const uno::Sequence<beans::NamedValue> & i_rStats)
2345 static const char* s_stats[] =
2346 { "TableCount", "CellCount", "ObjectCount", 0 };
2348 SvXMLImport::SetStatistics(i_rStats);
2350 sal_uInt32 nCount(0);
2351 for (sal_Int32 i = 0; i < i_rStats.getLength(); ++i) {
2352 for (const char** pStat = s_stats; *pStat != 0; ++pStat) {
2353 if (i_rStats[i].Name.equalsAscii(*pStat)) {
2354 sal_Int32 val = 0;
2355 if (i_rStats[i].Value >>= val) {
2356 nCount += val;
2357 } else {
2358 OSL_FAIL("ScXMLImport::SetStatistics: invalid entry");
2364 if (nCount)
2366 GetProgressBarHelper()->SetReference(nCount);
2367 GetProgressBarHelper()->SetValue(0);
2371 ScDocumentImport& ScXMLImport::GetDoc()
2373 return *mpDocImport;
2376 sal_Int16 ScXMLImport::GetCellType(const OUString& rStrValue) const
2378 CellTypeMap::const_iterator itr = aCellTypeMap.find(rStrValue);
2379 if (itr != aCellTypeMap.end())
2380 return itr->second;
2382 return util::NumberFormat::UNDEFINED;
2385 XMLShapeImportHelper* ScXMLImport::CreateShapeImport()
2387 return new XMLTableShapeImportHelper(*this);
2390 bool ScXMLImport::GetValidation(const OUString& sName, ScMyImportValidation& aValidation)
2392 if (pValidations)
2394 bool bFound(false);
2395 ScMyImportValidations::iterator aItr(pValidations->begin());
2396 ScMyImportValidations::iterator aEndItr(pValidations->end());
2397 while(aItr != aEndItr && !bFound)
2399 if (aItr->sName == sName)
2401 // source position must be set as string,
2402 // so sBaseCellAddress no longer has to be converted here
2404 bFound = true;
2406 else
2407 ++aItr;
2409 if (bFound)
2410 aValidation = *aItr;
2411 return bFound;
2413 return false;
2416 void ScXMLImport::AddNamedExpression(SCTAB nTab, ScMyNamedExpression* pNamedExp)
2418 ::std::auto_ptr<ScMyNamedExpression> p(pNamedExp);
2419 SheetNamedExpMap::iterator itr = maSheetNamedExpressions.find(nTab);
2420 if (itr == maSheetNamedExpressions.end())
2422 // No chain exists for this sheet. Create one.
2423 ::std::auto_ptr<ScMyNamedExpressions> pNew(new ScMyNamedExpressions);
2424 ::std::pair<SheetNamedExpMap::iterator, bool> r = maSheetNamedExpressions.insert(nTab, pNew);
2425 if (!r.second)
2426 // insertion failed.
2427 return;
2429 itr = r.first;
2431 ScMyNamedExpressions& r = *itr->second;
2432 r.push_back(p);
2435 ScXMLChangeTrackingImportHelper* ScXMLImport::GetChangeTrackingImportHelper()
2437 if (!pChangeTrackingImportHelper)
2438 pChangeTrackingImportHelper = new ScXMLChangeTrackingImportHelper();
2439 return pChangeTrackingImportHelper;
2442 void ScXMLImport::InsertStyles()
2444 GetStyles()->CopyStylesToDoc(true);
2446 // if content is going to be loaded with the same import, set bLatinDefaultStyle flag now
2447 if ( getImportFlags() & IMPORT_CONTENT )
2448 ExamineDefaultStyle();
2451 void ScXMLImport::ExamineDefaultStyle()
2453 if (pDoc)
2455 // #i62435# after inserting the styles, check if the default style has a latin-script-only
2456 // number format (then, value cells can be pre-initialized with western script type)
2458 const ScPatternAttr* pDefPattern = pDoc->GetDefPattern();
2459 SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
2460 if ( pFormatter && pDefPattern )
2462 sal_uInt32 nKey = pDefPattern->GetNumberFormat(pFormatter);
2463 const SvNumberformat* pFormat = pFormatter->GetEntry(nKey);
2464 if ( pFormat && pFormat->IsStandard() )
2466 // The standard format is all-latin if the decimal separator doesn't
2467 // have a different script type
2469 OUString aDecSep;
2470 LanguageType nFormatLang = pFormat->GetLanguage();
2471 if ( nFormatLang == LANGUAGE_SYSTEM )
2472 aDecSep = ScGlobal::pLocaleData->getNumDecimalSep();
2473 else
2475 LocaleDataWrapper aLocaleData( comphelper::getProcessComponentContext(),
2476 LanguageTag( nFormatLang ) );
2477 aDecSep = aLocaleData.getNumDecimalSep();
2480 sal_uInt8 nScript = pDoc->GetStringScriptType( aDecSep );
2481 if ( nScript == 0 || nScript == SCRIPTTYPE_LATIN )
2482 mpDocImport->setDefaultNumericScript(SCRIPTTYPE_LATIN);
2488 void ScXMLImport::SetChangeTrackingViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rChangeProps)
2490 if (pDoc)
2492 sal_Int32 nCount(rChangeProps.getLength());
2493 if (nCount)
2495 ScXMLImport::MutexGuard aGuard(*this);
2496 sal_Int16 nTemp16(0);
2497 boost::scoped_ptr<ScChangeViewSettings> pViewSettings(new ScChangeViewSettings());
2498 for (sal_Int32 i = 0; i < nCount; ++i)
2500 OUString sName(rChangeProps[i].Name);
2501 if (sName.equalsAscii("ShowChanges"))
2502 pViewSettings->SetShowChanges(::cppu::any2bool(rChangeProps[i].Value));
2503 else if (sName.equalsAscii("ShowAcceptedChanges"))
2504 pViewSettings->SetShowAccepted(::cppu::any2bool(rChangeProps[i].Value));
2505 else if (sName.equalsAscii("ShowRejectedChanges"))
2506 pViewSettings->SetShowRejected(::cppu::any2bool(rChangeProps[i].Value));
2507 else if (sName.equalsAscii("ShowChangesByDatetime"))
2508 pViewSettings->SetHasDate(::cppu::any2bool(rChangeProps[i].Value));
2509 else if (sName.equalsAscii("ShowChangesByDatetimeMode"))
2511 if (rChangeProps[i].Value >>= nTemp16)
2512 pViewSettings->SetTheDateMode(ScChgsDateMode(nTemp16));
2514 else if (sName.equalsAscii("ShowChangesByDatetimeFirstDatetime"))
2516 util::DateTime aDateTime;
2517 if (rChangeProps[i].Value >>= aDateTime)
2519 DateTime aCoreDateTime( DateTime::EMPTY );
2520 ScXMLConverter::ConvertAPIToCoreDateTime(aDateTime, aCoreDateTime);
2521 pViewSettings->SetTheFirstDateTime(aCoreDateTime);
2524 else if (sName.equalsAscii("ShowChangesByDatetimeSecondDatetime"))
2526 util::DateTime aDateTime;
2527 if (rChangeProps[i].Value >>= aDateTime)
2529 DateTime aCoreDateTime( DateTime::EMPTY );
2530 ScXMLConverter::ConvertAPIToCoreDateTime(aDateTime, aCoreDateTime);
2531 pViewSettings->SetTheLastDateTime(aCoreDateTime);
2534 else if (sName.equalsAscii("ShowChangesByAuthor"))
2535 pViewSettings->SetHasAuthor(::cppu::any2bool(rChangeProps[i].Value));
2536 else if (sName.equalsAscii("ShowChangesByAuthorName"))
2538 OUString sOUName;
2539 if (rChangeProps[i].Value >>= sOUName)
2541 OUString sAuthorName(sOUName);
2542 pViewSettings->SetTheAuthorToShow(sAuthorName);
2545 else if (sName.equalsAscii("ShowChangesByComment"))
2546 pViewSettings->SetHasComment(::cppu::any2bool(rChangeProps[i].Value));
2547 else if (sName.equalsAscii("ShowChangesByCommentText"))
2549 OUString sOUComment;
2550 if (rChangeProps[i].Value >>= sOUComment)
2552 OUString sComment(sOUComment);
2553 pViewSettings->SetTheComment(sComment);
2556 else if (sName.equalsAscii("ShowChangesByRanges"))
2557 pViewSettings->SetHasRange(::cppu::any2bool(rChangeProps[i].Value));
2558 else if (sName.equalsAscii("ShowChangesByRangesList"))
2560 OUString sRanges;
2561 if ((rChangeProps[i].Value >>= sRanges) && !sRanges.isEmpty())
2563 ScRangeList aRangeList;
2564 ScRangeStringConverter::GetRangeListFromString(
2565 aRangeList, sRanges, GetDocument(), FormulaGrammar::CONV_OOO);
2566 pViewSettings->SetTheRangeList(aRangeList);
2570 pDoc->SetChangeViewSettings(*pViewSettings);
2575 void ScXMLImport::SetViewSettings(const uno::Sequence<beans::PropertyValue>& aViewProps)
2577 sal_Int32 nCount(aViewProps.getLength());
2578 sal_Int32 nHeight(0);
2579 sal_Int32 nLeft(0);
2580 sal_Int32 nTop(0);
2581 sal_Int32 nWidth(0);
2582 for (sal_Int32 i = 0; i < nCount; ++i)
2584 OUString sName(aViewProps[i].Name);
2585 if (sName.equalsAscii("VisibleAreaHeight"))
2586 aViewProps[i].Value >>= nHeight;
2587 else if (sName.equalsAscii("VisibleAreaLeft"))
2588 aViewProps[i].Value >>= nLeft;
2589 else if (sName.equalsAscii("VisibleAreaTop"))
2590 aViewProps[i].Value >>= nTop;
2591 else if (sName.equalsAscii("VisibleAreaWidth"))
2592 aViewProps[i].Value >>= nWidth;
2593 else if (sName.equalsAscii("TrackedChangesViewSettings"))
2595 uno::Sequence<beans::PropertyValue> aChangeProps;
2596 if(aViewProps[i].Value >>= aChangeProps)
2597 SetChangeTrackingViewSettings(aChangeProps);
2600 if (nHeight && nWidth)
2602 if (GetModel().is())
2604 ScModelObj* pDocObj(ScModelObj::getImplementation( GetModel() ));
2605 if (pDocObj)
2607 SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject();
2608 if (pEmbeddedObj)
2610 Rectangle aRect;
2611 aRect.setX( nLeft );
2612 aRect.setY( nTop );
2613 aRect.setWidth( nWidth );
2614 aRect.setHeight( nHeight );
2615 pEmbeddedObj->SetVisArea(aRect);
2622 void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyValue>& aConfigProps)
2624 if (GetModel().is())
2626 uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
2627 if (xMultiServiceFactory.is())
2629 sal_Int32 nCount(aConfigProps.getLength());
2630 OUString sCTName("TrackedChangesProtectionKey");
2631 OUString sVBName("VBACompatibilityMode");
2632 OUString sSCName("ScriptConfiguration");
2633 for (sal_Int32 i = nCount - 1; i >= 0; --i)
2635 if (aConfigProps[i].Name == sCTName)
2637 OUString sKey;
2638 if (aConfigProps[i].Value >>= sKey)
2640 uno::Sequence<sal_Int8> aPass;
2641 ::sax::Converter::decodeBase64(aPass, sKey);
2642 if (aPass.getLength())
2644 if (pDoc->GetChangeTrack())
2645 pDoc->GetChangeTrack()->SetProtection(aPass);
2646 else
2648 std::set<OUString> aUsers;
2649 ScChangeTrack* pTrack = new ScChangeTrack(pDoc, aUsers);
2650 pTrack->SetProtection(aPass);
2651 pDoc->SetChangeTrack(pTrack);
2656 // store the following items for later use (after document is loaded)
2657 else if ((aConfigProps[i].Name == sVBName) || (aConfigProps[i].Name == sSCName))
2659 uno::Reference< beans::XPropertySet > xImportInfo = getImportInfo();
2660 if (xImportInfo.is())
2662 uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = xImportInfo->getPropertySetInfo();
2663 if (xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName(aConfigProps[i].Name))
2664 xImportInfo->setPropertyValue( aConfigProps[i].Name, aConfigProps[i].Value );
2668 uno::Reference <uno::XInterface> xInterface = xMultiServiceFactory->createInstance("com.sun.star.comp.SpreadsheetSettings");
2669 uno::Reference <beans::XPropertySet> xProperties(xInterface, uno::UNO_QUERY);
2670 if (xProperties.is())
2671 SvXMLUnitConverter::convertPropertySet(xProperties, aConfigProps);
2676 sal_Int32 ScXMLImport::SetCurrencySymbol(const sal_Int32 nKey, const OUString& rCurrency)
2678 uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
2679 if (xNumberFormatsSupplier.is())
2681 uno::Reference <util::XNumberFormats> xLocalNumberFormats(xNumberFormatsSupplier->getNumberFormats());
2682 if (xLocalNumberFormats.is())
2684 OUString sFormatString;
2687 uno::Reference <beans::XPropertySet> xProperties(xLocalNumberFormats->getByKey(nKey));
2688 if (xProperties.is())
2690 lang::Locale aLocale;
2691 if (GetDocument() && (xProperties->getPropertyValue(sLocale) >>= aLocale))
2694 ScXMLImport::MutexGuard aGuard(*this);
2695 LocaleDataWrapper aLocaleData( comphelper::getProcessComponentContext(), LanguageTag( aLocale) );
2696 OUStringBuffer aBuffer(15);
2697 aBuffer.appendAscii("#");
2698 aBuffer.append( aLocaleData.getNumThousandSep() );
2699 aBuffer.appendAscii("##0");
2700 aBuffer.append( aLocaleData.getNumDecimalSep() );
2701 aBuffer.appendAscii("00 [$");
2702 aBuffer.append(rCurrency);
2703 aBuffer.appendAscii("]");
2704 sFormatString = aBuffer.makeStringAndClear();
2706 sal_Int32 nNewKey = xLocalNumberFormats->queryKey(sFormatString, aLocale, true);
2707 if (nNewKey == -1)
2708 nNewKey = xLocalNumberFormats->addNew(sFormatString, aLocale);
2709 return nNewKey;
2713 catch ( const util::MalformedNumberFormatException& rException )
2715 OUString sErrorMessage("Fehler im Formatstring ");
2716 sErrorMessage += sFormatString;
2717 sErrorMessage += " an Position ";
2718 sErrorMessage += OUString::number(rException.CheckPos);
2719 uno::Sequence<OUString> aSeq(1);
2720 aSeq[0] = sErrorMessage;
2721 uno::Reference<xml::sax::XLocator> xLocator;
2722 SetError(XMLERROR_API | XMLERROR_FLAG_ERROR, aSeq, rException.Message, xLocator);
2726 return nKey;
2729 bool ScXMLImport::IsCurrencySymbol(const sal_Int32 nNumberFormat, const OUString& sCurrentCurrency, const OUString& sBankSymbol)
2731 uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
2732 if (xNumberFormatsSupplier.is())
2734 uno::Reference <util::XNumberFormats> xLocalNumberFormats(xNumberFormatsSupplier->getNumberFormats());
2735 if (xLocalNumberFormats.is())
2739 uno::Reference <beans::XPropertySet> xNumberPropertySet(xLocalNumberFormats->getByKey(nNumberFormat));
2740 if (xNumberPropertySet.is())
2742 OUString sTemp;
2743 if ( xNumberPropertySet->getPropertyValue(OUString(SC_CURRENCYSYMBOL)) >>= sTemp)
2745 if (sCurrentCurrency.equals(sTemp))
2746 return true;
2747 // #i61657# This may be a legacy currency symbol that changed in the meantime.
2748 if (SvNumberFormatter::GetLegacyOnlyCurrencyEntry( sCurrentCurrency, sBankSymbol) != NULL)
2749 return true;
2750 // In the rare case that sCurrentCurrency is not the
2751 // currency symbol, but a matching ISO code
2752 // abbreviation instead that was obtained through
2753 // XMLNumberFormatAttributesExportHelper::GetCellType(),
2754 // check with the number format's symbol. This happens,
2755 // for example, in the es_BO locale, where a legacy
2756 // B$,BOB matched B$->BOP, which leads to
2757 // sCurrentCurrency being BOP, and the previous call
2758 // with BOP,BOB didn't find an entry, but B$,BOB will.
2759 return SvNumberFormatter::GetLegacyOnlyCurrencyEntry( sTemp, sBankSymbol) != NULL;
2763 catch ( uno::Exception& )
2765 OSL_FAIL("Numberformat not found");
2769 return false;
2772 void ScXMLImport::SetType(uno::Reference <beans::XPropertySet>& rProperties,
2773 sal_Int32& rNumberFormat,
2774 const sal_Int16 nCellType,
2775 const OUString& rCurrency)
2777 if (!mbImportStyles)
2778 return;
2780 if ((nCellType != util::NumberFormat::TEXT) && (nCellType != util::NumberFormat::UNDEFINED))
2782 if (rNumberFormat == -1)
2783 rProperties->getPropertyValue( sNumberFormat ) >>= rNumberFormat;
2784 OSL_ENSURE(rNumberFormat != -1, "no NumberFormat");
2785 bool bIsStandard;
2786 // sCurrentCurrency may be the ISO code abbreviation if the currency
2787 // symbol matches such, or if no match found the symbol itself!
2788 OUString sCurrentCurrency;
2789 sal_Int32 nCurrentCellType(
2790 GetNumberFormatAttributesExportHelper()->GetCellType(
2791 rNumberFormat, sCurrentCurrency, bIsStandard) & ~util::NumberFormat::DEFINED);
2792 if ((nCellType != nCurrentCellType) && !((nCellType == util::NumberFormat::NUMBER &&
2793 ((nCurrentCellType == util::NumberFormat::SCIENTIFIC) ||
2794 (nCurrentCellType == util::NumberFormat::FRACTION) ||
2795 (nCurrentCellType == util::NumberFormat::LOGICAL) ||
2796 (nCurrentCellType == 0))) || (nCurrentCellType == util::NumberFormat::TEXT)) && !((nCellType == util::NumberFormat::DATETIME) &&
2797 (nCurrentCellType == util::NumberFormat::DATE)))
2799 if (!xNumberFormats.is())
2801 uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
2802 if (xNumberFormatsSupplier.is())
2803 xNumberFormats.set(xNumberFormatsSupplier->getNumberFormats());
2805 if (xNumberFormats.is())
2809 uno::Reference < beans::XPropertySet> xNumberFormatProperties(xNumberFormats->getByKey(rNumberFormat));
2810 if (xNumberFormatProperties.is())
2812 if (nCellType != util::NumberFormat::CURRENCY)
2814 lang::Locale aLocale;
2815 if ( xNumberFormatProperties->getPropertyValue(sLocale) >>= aLocale )
2817 if (!xNumberFormatTypes.is())
2818 xNumberFormatTypes.set(uno::Reference <util::XNumberFormatTypes>(xNumberFormats, uno::UNO_QUERY));
2819 rProperties->setPropertyValue( sNumberFormat, uno::makeAny(xNumberFormatTypes->getStandardFormat(nCellType, aLocale)) );
2822 else if (!rCurrency.isEmpty() && !sCurrentCurrency.isEmpty())
2824 if (!sCurrentCurrency.equals(rCurrency))
2825 if (!IsCurrencySymbol(rNumberFormat, sCurrentCurrency, rCurrency))
2826 rProperties->setPropertyValue( sNumberFormat, uno::makeAny(SetCurrencySymbol(rNumberFormat, rCurrency)));
2830 catch ( uno::Exception& )
2832 OSL_FAIL("Numberformat not found");
2836 else
2838 if ((nCellType == util::NumberFormat::CURRENCY) && !rCurrency.isEmpty() && !sCurrentCurrency.isEmpty() &&
2839 !sCurrentCurrency.equals(rCurrency) && !IsCurrencySymbol(rNumberFormat, sCurrentCurrency, rCurrency))
2840 rProperties->setPropertyValue( sNumberFormat, uno::makeAny(SetCurrencySymbol(rNumberFormat, rCurrency)));
2845 void ScXMLImport::AddStyleRange(const table::CellRangeAddress& rCellRange)
2847 if (!mbImportStyles)
2848 return;
2850 if (!xSheetCellRanges.is() && GetModel().is())
2852 uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
2853 if (xMultiServiceFactory.is())
2854 xSheetCellRanges.set(uno::Reference <sheet::XSheetCellRangeContainer>(xMultiServiceFactory->createInstance("com.sun.star.sheet.SheetCellRanges"), uno::UNO_QUERY));
2855 OSL_ENSURE(xSheetCellRanges.is(), "didn't get SheetCellRanges");
2858 xSheetCellRanges->addRangeAddress(rCellRange, false);
2861 void ScXMLImport::SetStyleToRanges()
2863 if (!mbImportStyles)
2864 return;
2866 if (!sPrevStyleName.isEmpty())
2868 uno::Reference <beans::XPropertySet> xProperties (xSheetCellRanges, uno::UNO_QUERY);
2869 if (xProperties.is())
2871 XMLTableStylesContext *pStyles((XMLTableStylesContext *)GetAutoStyles());
2872 XMLTableStyleContext* pStyle( pStyles ? (XMLTableStyleContext *)pStyles->FindStyleChildContext(
2873 XML_STYLE_FAMILY_TABLE_CELL, sPrevStyleName, true) : NULL );
2874 if (pStyle)
2876 pStyle->FillPropertySet(xProperties);
2877 // here needs to be the cond format import method
2878 sal_Int32 nNumberFormat(pStyle->GetNumberFormat());
2879 SetType(xProperties, nNumberFormat, nPrevCellType, sPrevCurrency);
2881 // store first cell of first range for each style, once per sheet
2882 uno::Sequence<table::CellRangeAddress> aAddresses(xSheetCellRanges->getRangeAddresses());
2883 pStyle->ApplyCondFormat(aAddresses);
2884 if ( aAddresses.getLength() > 0 )
2886 const table::CellRangeAddress& rRange = aAddresses[0];
2887 if ( rRange.Sheet != pStyle->GetLastSheet() )
2889 ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
2890 pSheetData->AddCellStyle( sPrevStyleName,
2891 ScAddress( (SCCOL)rRange.StartColumn, (SCROW)rRange.StartRow, (SCTAB)rRange.Sheet ) );
2892 pStyle->SetLastSheet(rRange.Sheet);
2896 else
2898 xProperties->setPropertyValue(sCellStyle, uno::makeAny(GetStyleDisplayName( XML_STYLE_FAMILY_TABLE_CELL, sPrevStyleName )));
2899 sal_Int32 nNumberFormat(GetStyleNumberFormats()->GetStyleNumberFormat(sPrevStyleName));
2900 bool bInsert(nNumberFormat == -1);
2901 SetType(xProperties, nNumberFormat, nPrevCellType, sPrevCurrency);
2902 if (bInsert)
2903 GetStyleNumberFormats()->AddStyleNumberFormat(sPrevStyleName, nNumberFormat);
2907 if (GetModel().is())
2909 uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
2910 if (xMultiServiceFactory.is())
2911 xSheetCellRanges.set(uno::Reference <sheet::XSheetCellRangeContainer>(
2912 xMultiServiceFactory->createInstance(
2913 OUString("com.sun.star.sheet.SheetCellRanges")),
2914 uno::UNO_QUERY));
2916 OSL_ENSURE(xSheetCellRanges.is(), "didn't get SheetCellRanges");
2919 void ScXMLImport::SetStyleToRange(const ScRange& rRange, const OUString* pStyleName,
2920 const sal_Int16 nCellType, const OUString* pCurrency)
2922 if (!mbImportStyles)
2923 return;
2925 if (sPrevStyleName.isEmpty())
2927 nPrevCellType = nCellType;
2928 if (pStyleName)
2929 sPrevStyleName = *pStyleName;
2930 if (pCurrency)
2931 sPrevCurrency = *pCurrency;
2932 else if (!sPrevCurrency.isEmpty())
2933 sPrevCurrency = sEmpty;
2935 else if ((nCellType != nPrevCellType) ||
2936 ((pStyleName && !pStyleName->equals(sPrevStyleName)) ||
2937 (!pStyleName && !sPrevStyleName.isEmpty())) ||
2938 ((pCurrency && !pCurrency->equals(sPrevCurrency)) ||
2939 (!pCurrency && !sPrevCurrency.isEmpty())))
2941 SetStyleToRanges();
2942 nPrevCellType = nCellType;
2943 if (pStyleName)
2944 sPrevStyleName = *pStyleName;
2945 else if(!sPrevStyleName.isEmpty())
2946 sPrevStyleName = sEmpty;
2947 if (pCurrency)
2948 sPrevCurrency = *pCurrency;
2949 else if(!sPrevCurrency.isEmpty())
2950 sPrevCurrency = sEmpty;
2952 table::CellRangeAddress aCellRange;
2953 aCellRange.StartColumn = rRange.aStart.Col();
2954 aCellRange.StartRow = rRange.aStart.Row();
2955 aCellRange.Sheet = rRange.aStart.Tab();
2956 aCellRange.EndColumn = rRange.aEnd.Col();
2957 aCellRange.EndRow = rRange.aEnd.Row();
2958 AddStyleRange(aCellRange);
2961 bool ScXMLImport::SetNullDateOnUnitConverter()
2963 if (!bNullDateSetted)
2964 bNullDateSetted = GetMM100UnitConverter().setNullDate(GetModel());
2965 OSL_ENSURE(bNullDateSetted, "could not set the null date");
2966 return bNullDateSetted;
2969 XMLNumberFormatAttributesExportHelper* ScXMLImport::GetNumberFormatAttributesExportHelper()
2971 if (!pNumberFormatAttributesExportHelper)
2972 pNumberFormatAttributesExportHelper = new XMLNumberFormatAttributesExportHelper(GetNumberFormatsSupplier());
2973 return pNumberFormatAttributesExportHelper;
2976 ScMyStyleNumberFormats* ScXMLImport::GetStyleNumberFormats()
2978 if (!pStyleNumberFormats)
2979 pStyleNumberFormats = new ScMyStyleNumberFormats();
2980 return pStyleNumberFormats;
2983 void ScXMLImport::SetStylesToRangesFinished()
2985 SetStyleToRanges();
2986 sPrevStyleName = sEmpty;
2989 // XImporter
2990 void SAL_CALL ScXMLImport::setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
2991 throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception)
2993 ScXMLImport::MutexGuard aGuard(*this);
2994 SvXMLImport::setTargetDocument( xDoc );
2996 uno::Reference<frame::XModel> xModel(xDoc, uno::UNO_QUERY);
2997 pDoc = ScXMLConverter::GetScDocument( xModel );
2998 OSL_ENSURE( pDoc, "ScXMLImport::setTargetDocument - no ScDocument!" );
2999 if (!pDoc)
3000 throw lang::IllegalArgumentException();
3002 mpDocImport.reset(new ScDocumentImport(*pDoc));
3003 mpComp.reset(new ScCompiler(pDoc, ScAddress()));
3004 mpComp->SetGrammar(formula::FormulaGrammar::GRAM_ODFF);
3006 uno::Reference<document::XActionLockable> xActionLockable(xDoc, uno::UNO_QUERY);
3007 if (xActionLockable.is())
3008 xActionLockable->addActionLock();
3011 // ::com::sun::star::xml::sax::XDocumentHandler
3012 void SAL_CALL ScXMLImport::startDocument(void)
3013 throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception )
3015 ScXMLImport::MutexGuard aGuard(*this);
3016 SvXMLImport::startDocument();
3017 if (pDoc && !pDoc->IsImportingXML())
3019 ScModelObj::getImplementation(GetModel())->BeforeXMLLoading();
3020 bSelfImportingXMLSet = true;
3023 // if content and styles are loaded with separate imports,
3024 // set bLatinDefaultStyle flag at the start of the content import
3025 sal_uInt16 nFlags = getImportFlags();
3026 if ( ( nFlags & IMPORT_CONTENT ) && !( nFlags & IMPORT_STYLES ) )
3027 ExamineDefaultStyle();
3029 if (getImportFlags() & IMPORT_CONTENT)
3031 if (GetModel().is())
3033 // store initial namespaces, to find the ones that were added from the file later
3034 ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
3035 const SvXMLNamespaceMap& rNamespaces = GetNamespaceMap();
3036 pSheetData->StoreInitialNamespaces(rNamespaces);
3040 uno::Reference< beans::XPropertySet > const xImportInfo( getImportInfo() );
3041 uno::Reference< beans::XPropertySetInfo > const xPropertySetInfo(
3042 xImportInfo.is() ? xImportInfo->getPropertySetInfo() : 0);
3043 if (xPropertySetInfo.is())
3045 OUString const sOrganizerMode(
3046 "OrganizerMode");
3047 if (xPropertySetInfo->hasPropertyByName(sOrganizerMode))
3049 bool bStyleOnly(false);
3050 if (xImportInfo->getPropertyValue(sOrganizerMode) >>= bStyleOnly)
3052 bLoadDoc = !bStyleOnly;
3057 UnlockSolarMutex();
3060 sal_Int32 ScXMLImport::GetRangeType(const OUString& sRangeType) const
3062 sal_Int32 nRangeType(0);
3063 OUStringBuffer sBuffer;
3064 sal_Int16 i = 0;
3065 while (i <= sRangeType.getLength())
3067 if ((i == sRangeType.getLength()) || (sRangeType[i] == ' '))
3069 OUString sTemp = sBuffer.makeStringAndClear();
3070 if (sTemp.equalsAscii(SC_REPEAT_COLUMN))
3071 nRangeType |= sheet::NamedRangeFlag::COLUMN_HEADER;
3072 else if (sTemp.equalsAscii(SC_REPEAT_ROW))
3073 nRangeType |= sheet::NamedRangeFlag::ROW_HEADER;
3074 else if (sTemp.equalsAscii(SC_FILTER))
3075 nRangeType |= sheet::NamedRangeFlag::FILTER_CRITERIA;
3076 else if (sTemp.equalsAscii(SC_PRINT_RANGE))
3077 nRangeType |= sheet::NamedRangeFlag::PRINT_AREA;
3079 else if (i < sRangeType.getLength())
3080 sBuffer.append(sRangeType[i]);
3081 ++i;
3083 return nRangeType;
3086 void ScXMLImport::SetLabelRanges()
3088 ScMyLabelRanges* pLabelRanges = GetLabelRanges();
3089 if (pLabelRanges)
3091 uno::Reference <beans::XPropertySet> xPropertySet (GetModel(), uno::UNO_QUERY);
3092 if (xPropertySet.is())
3094 uno::Any aColAny = xPropertySet->getPropertyValue(OUString(SC_UNO_COLLABELRNG));
3095 uno::Any aRowAny = xPropertySet->getPropertyValue(OUString(SC_UNO_ROWLABELRNG));
3097 uno::Reference< sheet::XLabelRanges > xColRanges;
3098 uno::Reference< sheet::XLabelRanges > xRowRanges;
3100 if ( ( aColAny >>= xColRanges ) && ( aRowAny >>= xRowRanges ) )
3102 table::CellRangeAddress aLabelRange;
3103 table::CellRangeAddress aDataRange;
3105 ScMyLabelRanges::iterator aItr = pLabelRanges->begin();
3106 while (aItr != pLabelRanges->end())
3108 sal_Int32 nOffset1(0);
3109 sal_Int32 nOffset2(0);
3110 FormulaGrammar::AddressConvention eConv = FormulaGrammar::CONV_OOO;
3112 if (ScRangeStringConverter::GetRangeFromString( aLabelRange, (*aItr)->sLabelRangeStr, GetDocument(), eConv, nOffset1 ) &&
3113 ScRangeStringConverter::GetRangeFromString( aDataRange, (*aItr)->sDataRangeStr, GetDocument(), eConv, nOffset2 ))
3115 if ( (*aItr)->bColumnOrientation )
3116 xColRanges->addNew( aLabelRange, aDataRange );
3117 else
3118 xRowRanges->addNew( aLabelRange, aDataRange );
3121 delete *aItr;
3122 aItr = pLabelRanges->erase(aItr);
3129 namespace {
3131 class RangeNameInserter : public ::std::unary_function<ScMyNamedExpression, void>
3133 ScDocument* mpDoc;
3134 ScRangeName& mrRangeName;
3135 ScXMLImport& mrXmlImport;
3137 public:
3138 RangeNameInserter(ScDocument* pDoc, ScRangeName& rRangeName, ScXMLImport& rXmlImport) :
3139 mpDoc(pDoc), mrRangeName(rRangeName), mrXmlImport(rXmlImport) {}
3141 void operator() (const ScMyNamedExpression& r) const
3143 using namespace formula;
3145 const OUString& aType = r.sRangeType;
3146 sal_uInt32 nUnoType = mrXmlImport.GetRangeType(aType);
3148 sal_uInt16 nNewType = RT_NAME;
3149 if ( nUnoType & sheet::NamedRangeFlag::FILTER_CRITERIA ) nNewType |= RT_CRITERIA;
3150 if ( nUnoType & sheet::NamedRangeFlag::PRINT_AREA ) nNewType |= RT_PRINTAREA;
3151 if ( nUnoType & sheet::NamedRangeFlag::COLUMN_HEADER ) nNewType |= RT_COLHEADER;
3152 if ( nUnoType & sheet::NamedRangeFlag::ROW_HEADER ) nNewType |= RT_ROWHEADER;
3154 if (mpDoc)
3156 // Insert a new name.
3157 ScAddress aPos;
3158 sal_Int32 nOffset = 0;
3159 bool bSuccess = ScRangeStringConverter::GetAddressFromString(
3160 aPos, r.sBaseCellAddress, mpDoc, FormulaGrammar::CONV_OOO, nOffset);
3162 if (bSuccess)
3164 OUString aContent = r.sContent;
3165 if (!r.bIsExpression)
3166 ScXMLConverter::ParseFormula(aContent, false);
3168 ScRangeData* pData = new ScRangeData(
3169 mpDoc, r.sName, aContent, aPos, nNewType, r.eGrammar);
3170 mrRangeName.insert(pData);
3178 void ScXMLImport::SetNamedRanges()
3180 ScMyNamedExpressions* pNamedExpressions = GetNamedExpressions();
3181 if (!pNamedExpressions)
3182 return;
3184 if (!pDoc)
3185 return;
3187 // Insert the namedRanges
3188 ScRangeName* pRangeNames = pDoc->GetRangeName();
3189 ::std::for_each(pNamedExpressions->begin(), pNamedExpressions->end(), RangeNameInserter(pDoc, *pRangeNames, *this));
3192 void ScXMLImport::SetSheetNamedRanges()
3194 if (!pDoc)
3195 return;
3197 SheetNamedExpMap::const_iterator itr = maSheetNamedExpressions.begin(), itrEnd = maSheetNamedExpressions.end();
3198 for (; itr != itrEnd; ++itr)
3200 SCTAB nTab = itr->first;
3201 ScRangeName* pRangeNames = pDoc->GetRangeName(nTab);
3202 if (!pRangeNames)
3203 continue;
3205 const ScMyNamedExpressions& rNames = *itr->second;
3206 ::std::for_each(rNames.begin(), rNames.end(), RangeNameInserter(pDoc, *pRangeNames, *this));
3210 void SAL_CALL ScXMLImport::endDocument()
3211 throw(::com::sun::star::xml::sax::SAXException,
3212 ::com::sun::star::uno::RuntimeException,
3213 std::exception)
3215 ScXMLImport::MutexGuard aGuard(*this);
3216 if (getImportFlags() & IMPORT_CONTENT)
3218 if (GetModel().is())
3220 mpDocImport->finalize();
3222 uno::Reference<document::XViewDataSupplier> xViewDataSupplier(GetModel(), uno::UNO_QUERY);
3223 if (xViewDataSupplier.is())
3225 uno::Reference<container::XIndexAccess> xIndexAccess(xViewDataSupplier->getViewData());
3226 if (xIndexAccess.is() && xIndexAccess->getCount() > 0)
3228 uno::Sequence< beans::PropertyValue > aSeq;
3229 if (xIndexAccess->getByIndex(0) >>= aSeq)
3231 sal_Int32 nCount (aSeq.getLength());
3232 for (sal_Int32 i = 0; i < nCount; ++i)
3234 OUString sName(aSeq[i].Name);
3235 if (sName.equalsAscii(SC_ACTIVETABLE))
3237 OUString sValue;
3238 if(aSeq[i].Value >>= sValue)
3240 OUString sTabName(sValue);
3241 SCTAB nTab(0);
3242 if (pDoc->GetTable(sTabName, nTab))
3244 pDoc->SetVisibleTab(nTab);
3245 i = nCount;
3253 SetLabelRanges();
3254 SetNamedRanges();
3255 SetSheetNamedRanges();
3256 if (mpPivotSources)
3257 // Process pivot table sources after the named ranges have been set.
3258 mpPivotSources->process();
3260 GetProgressBarHelper()->End(); // make room for subsequent SfxProgressBars
3261 if (pDoc)
3263 pDoc->CompileXML();
3265 // After CompileXML, links must be completely changed to the new URLs.
3266 // Otherwise, hasExternalFile for API wouldn't work (#i116940#),
3267 // and typing a new formula would create a second link with the same "real" file name.
3268 if (pDoc->HasExternalRefManager())
3269 pDoc->GetExternalRefManager()->updateAbsAfterLoad();
3272 // If the stream contains cells outside of the current limits, the styles can't be re-created,
3273 // so stream copying is disabled then.
3274 if (pDoc && GetModel().is() && !pDoc->HasRangeOverflow())
3276 // set "valid stream" flags after loading (before UpdateRowHeights, so changed formula results
3277 // in UpdateRowHeights can already clear the flags again)
3278 ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
3280 SCTAB nTabCount = pDoc->GetTableCount();
3281 for (SCTAB nTab=0; nTab<nTabCount; ++nTab)
3283 pDoc->SetDrawPageSize(nTab);
3284 if (!pSheetData->IsSheetBlocked( nTab ))
3285 pDoc->SetStreamValid( nTab, true );
3288 aTables.FixupOLEs();
3290 if (GetModel().is())
3292 uno::Reference<document::XActionLockable> xActionLockable(GetModel(), uno::UNO_QUERY);
3293 if (xActionLockable.is())
3294 xActionLockable->removeActionLock();
3296 SvXMLImport::endDocument();
3298 if(pDoc && bSelfImportingXMLSet)
3299 ScModelObj::getImplementation(GetModel())->AfterXMLLoading(true);
3302 // XEventListener
3303 void ScXMLImport::DisposingModel()
3305 SvXMLImport::DisposingModel();
3306 pDoc = NULL;
3309 ScXMLImport::MutexGuard::MutexGuard(ScXMLImport& rImport) :
3310 mrImport(rImport)
3312 mrImport.LockSolarMutex();
3315 ScXMLImport::MutexGuard::~MutexGuard()
3317 mrImport.UnlockSolarMutex();
3320 void ScXMLImport::LockSolarMutex()
3322 // #i62677# When called from DocShell/Wrapper, the SolarMutex is already locked,
3323 // so there's no need to allocate (and later delete) the SolarMutexGuard.
3324 if (!mbLockSolarMutex)
3326 DBG_TESTSOLARMUTEX();
3327 return;
3330 if (nSolarMutexLocked == 0)
3332 OSL_ENSURE(!pSolarMutexGuard, "Solar Mutex is locked");
3333 pSolarMutexGuard = new SolarMutexGuard();
3335 ++nSolarMutexLocked;
3339 void ScXMLImport::UnlockSolarMutex()
3341 if (nSolarMutexLocked > 0)
3343 nSolarMutexLocked--;
3344 if (nSolarMutexLocked == 0)
3346 OSL_ENSURE(pSolarMutexGuard, "Solar Mutex is always unlocked");
3347 delete pSolarMutexGuard;
3348 pSolarMutexGuard = NULL;
3353 sal_Int32 ScXMLImport::GetByteOffset()
3355 sal_Int32 nOffset = -1;
3356 uno::Reference<xml::sax::XLocator> xLocator = GetLocator();
3357 uno::Reference<io::XSeekable> xSeek( xLocator, uno::UNO_QUERY ); //! should use different interface
3358 if ( xSeek.is() )
3359 nOffset = (sal_Int32)xSeek->getPosition();
3360 return nOffset;
3363 void ScXMLImport::SetRangeOverflowType(sal_uInt32 nType)
3365 // #i31130# Overflow is stored in the document, because the ScXMLImport object
3366 // isn't available in ScXMLImportWrapper::ImportFromComponent when using the
3367 // OOo->Oasis transformation.
3369 if ( pDoc )
3370 pDoc->SetRangeOverflowType( nType );
3373 void ScXMLImport::ProgressBarIncrement(bool bEditCell, sal_Int32 nInc)
3375 nProgressCount += nInc;
3376 if (bEditCell || nProgressCount > 100)
3378 GetProgressBarHelper()->Increment(nProgressCount);
3379 nProgressCount = 0;
3383 void ScXMLImport::ExtractFormulaNamespaceGrammar(
3384 OUString& rFormula, OUString& rFormulaNmsp, FormulaGrammar::Grammar& reGrammar,
3385 const OUString& rAttrValue, bool bRestrictToExternalNmsp ) const
3387 // parse the attribute value, extract namespace ID, literal namespace, and formula string
3388 rFormulaNmsp = OUString();
3389 sal_uInt16 nNsId = GetNamespaceMap()._GetKeyByAttrName( rAttrValue, 0, &rFormula, &rFormulaNmsp, false );
3391 // check if we have an ODF formula namespace
3392 if( !bRestrictToExternalNmsp ) switch( nNsId )
3394 case XML_NAMESPACE_OOOC:
3395 rFormulaNmsp = OUString(); // remove namespace string for built-in grammar
3396 reGrammar = FormulaGrammar::GRAM_PODF;
3397 return;
3398 case XML_NAMESPACE_OF:
3399 rFormulaNmsp = OUString(); // remove namespace string for built-in grammar
3400 reGrammar = FormulaGrammar::GRAM_ODFF;
3401 return;
3404 /* Find default grammar for formulas without namespace. There may be
3405 documents in the wild that stored no namespace in ODF 1.0/1.1. Use
3406 GRAM_PODF then (old style ODF 1.0/1.1 formulas). The default for ODF
3407 1.2 and later without namespace is GRAM_ODFF (OpenFormula). */
3408 FormulaGrammar::Grammar eDefaultGrammar =
3409 (GetDocument()->GetStorageGrammar() == FormulaGrammar::GRAM_PODF) ?
3410 FormulaGrammar::GRAM_PODF : FormulaGrammar::GRAM_ODFF;
3412 /* Check if we have no namespace at all. The value XML_NAMESPACE_NONE
3413 indicates that there is no colon. If the first character of the
3414 attribute value is the equality sign, the value XML_NAMESPACE_UNKNOWN
3415 indicates that there is a colon somewhere in the formula string. */
3416 if( (nNsId == XML_NAMESPACE_NONE) || ((nNsId == XML_NAMESPACE_UNKNOWN) && (rAttrValue.toChar() == '=')) )
3418 rFormula = rAttrValue; // return entire string as formula
3419 reGrammar = eDefaultGrammar;
3420 return;
3423 /* Check if a namespace URL could be resolved from the attribute value.
3424 Use that namespace only, if the Calc document knows an associated
3425 external formula parser. This prevents that the range operator in
3426 conjunction with defined names is confused as namespaces prefix, e.g.
3427 in the expression 'table:A1' where 'table' is a named reference. */
3428 if( ((nNsId & XML_NAMESPACE_UNKNOWN_FLAG) != 0) && !rFormulaNmsp.isEmpty() &&
3429 GetDocument()->GetFormulaParserPool().hasFormulaParser( rFormulaNmsp ) )
3431 reGrammar = FormulaGrammar::GRAM_EXTERNAL;
3432 return;
3435 /* All attempts failed (e.g. no namespace and no leading equality sign, or
3436 an invalid namespace prefix), continue with the entire attribute value. */
3437 rFormula = rAttrValue;
3438 rFormulaNmsp = OUString(); // remove any namespace string
3439 reGrammar = eDefaultGrammar;
3442 bool ScXMLImport::IsFormulaErrorConstant( const OUString& rStr ) const
3444 if (!mpComp)
3445 return false;
3447 return mpComp->GetErrorConstant(rStr) > 0;
3450 ScEditEngineDefaulter* ScXMLImport::GetEditEngine()
3452 if (!mpEditEngine)
3454 mpEditEngine.reset(new ScEditEngineDefaulter(pDoc->GetEnginePool()));
3455 mpEditEngine->SetRefMapMode(MAP_100TH_MM);
3456 mpEditEngine->SetEditTextObjectPool(pDoc->GetEditPool());
3457 mpEditEngine->SetUpdateMode(false);
3458 mpEditEngine->EnableUndo(false);
3459 mpEditEngine->SetControlWord(mpEditEngine->GetControlWord() & ~EE_CNTRL_ALLOWBIGOBJS);
3461 return mpEditEngine.get();
3464 const ScXMLEditAttributeMap& ScXMLImport::GetEditAttributeMap() const
3466 if (!mpEditAttrMap)
3467 mpEditAttrMap.reset(new ScXMLEditAttributeMap);
3468 return *mpEditAttrMap;
3471 void ScXMLImport::NotifyEmbeddedFontRead()
3473 if ( pDoc )
3474 pDoc->SetIsUsingEmbededFonts( true );
3477 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */