fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / filter / xml / xmlimprt.cxx
blobd1bb29982160ed8b4fb86345a365c2711f141962
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 <sal/config.h>
22 #include <o3tl/ptr_container.hxx>
23 #include <svl/zforlist.hxx>
24 #include <sal/macros.h>
26 #include <xmloff/nmspmap.hxx>
27 #include <xmloff/xmlnmspe.hxx>
28 #include <xmloff/i18nmap.hxx>
29 #include <xmloff/xmltkmap.hxx>
30 #include <xmloff/xmlictxt.hxx>
31 #include <xmloff/xmlmetai.hxx>
32 #include <sfx2/objsh.hxx>
33 #include <xmloff/xmlnumfi.hxx>
34 #include <xmloff/xmlscripti.hxx>
35 #include <xmloff/XMLFontStylesContext.hxx>
36 #include <xmloff/DocumentSettingsContext.hxx>
37 #include <xmloff/xmluconv.hxx>
38 #include <xmloff/numehelp.hxx>
39 #include <xmloff/xmltoken.hxx>
40 #include <xmloff/xmlerror.hxx>
42 #include <sax/tools/converter.hxx>
44 #include <svl/zformat.hxx>
45 #include <svl/languageoptions.hxx>
46 #include <editeng/editstat.hxx>
48 #include "appluno.hxx"
49 #include "xmlimprt.hxx"
50 #include "document.hxx"
51 #include "docsh.hxx"
52 #include "docuno.hxx"
53 #include "nameuno.hxx"
54 #include "xmlbodyi.hxx"
55 #include "xmlstyli.hxx"
56 #include "ViewSettingsSequenceDefines.hxx"
58 #include "patattr.hxx"
60 #include "XMLConverter.hxx"
61 #include "XMLDetectiveContext.hxx"
62 #include "XMLTableShapeImportHelper.hxx"
63 #include "XMLChangeTrackingImportHelper.hxx"
64 #include "chgviset.hxx"
65 #include "XMLStylesImportHelper.hxx"
66 #include "sheetdata.hxx"
67 #include "rangeutl.hxx"
68 #include "postit.hxx"
69 #include "formulaparserpool.hxx"
70 #include "externalrefmgr.hxx"
71 #include "editutil.hxx"
72 #include "editattributemap.hxx"
73 #include "documentimport.hxx"
74 #include "pivotsource.hxx"
75 #include <unonames.hxx>
76 #include <numformat.hxx>
78 #include <comphelper/extract.hxx>
80 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
81 #include <com/sun/star/frame/XModel.hpp>
82 #include <com/sun/star/sheet/XSheetCellRange.hpp>
83 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
84 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
85 #include <com/sun/star/util/XMergeable.hpp>
86 #include <com/sun/star/sheet/CellInsertMode.hpp>
87 #include <com/sun/star/sheet/XCellRangeMovement.hpp>
88 #include <com/sun/star/document/XActionLockable.hpp>
89 #include <com/sun/star/util/NumberFormat.hpp>
90 #include <com/sun/star/util/XNumberFormatTypes.hpp>
91 #include <com/sun/star/sheet/XNamedRanges.hpp>
92 #include <com/sun/star/sheet/NamedRangeFlag.hpp>
93 #include <com/sun/star/sheet/XNamedRange.hpp>
94 #include <com/sun/star/sheet/XLabelRanges.hpp>
95 #include <com/sun/star/io/XSeekable.hpp>
96 #include <com/sun/star/beans/XPropertySet.hpp>
98 #include <memory>
99 #include <utility>
101 #define SC_LOCALE "Locale"
102 #define SC_STANDARDFORMAT "StandardFormat"
103 #define SC_CURRENCYSYMBOL "CurrencySymbol"
104 #define SC_REPEAT_ROW "repeat-row"
105 #define SC_FILTER "filter"
106 #define SC_PRINT_RANGE "print-range"
108 using namespace com::sun::star;
109 using namespace ::xmloff::token;
110 using namespace ::formula;
111 using ::com::sun::star::uno::Reference;
112 using ::com::sun::star::uno::UNO_QUERY;
114 OUString SAL_CALL ScXMLImport_getImplementationName() throw()
116 return OUString( "com.sun.star.comp.Calc.XMLOasisImporter" );
119 uno::Sequence< OUString > SAL_CALL ScXMLImport_getSupportedServiceNames() throw()
121 const OUString aServiceName( ScXMLImport_getImplementationName() );
122 return uno::Sequence< OUString > ( &aServiceName, 1 );
125 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_createInstance(
126 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
128 // #110680#
129 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_ALL);
130 return (cppu::OWeakObject*)new ScXMLImport( comphelper::getComponentContext(rSMgr), ScXMLImport_getImplementationName(), SvXMLImportFlags::ALL );
133 OUString SAL_CALL ScXMLImport_Meta_getImplementationName() throw()
135 return OUString( "com.sun.star.comp.Calc.XMLOasisMetaImporter" );
138 uno::Sequence< OUString > SAL_CALL ScXMLImport_Meta_getSupportedServiceNames() throw()
140 const OUString aServiceName( ScXMLImport_Meta_getImplementationName() );
141 return uno::Sequence< OUString > ( &aServiceName, 1 );
144 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Meta_createInstance(
145 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
147 // #110680#
148 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_META);
149 return (cppu::OWeakObject*)new ScXMLImport( comphelper::getComponentContext(rSMgr), ScXMLImport_Meta_getImplementationName(), SvXMLImportFlags::META );
152 OUString SAL_CALL ScXMLImport_Styles_getImplementationName() throw()
154 return OUString( "com.sun.star.comp.Calc.XMLOasisStylesImporter" );
157 uno::Sequence< OUString > SAL_CALL ScXMLImport_Styles_getSupportedServiceNames() throw()
159 const OUString aServiceName( ScXMLImport_Styles_getImplementationName() );
160 return uno::Sequence< OUString > ( &aServiceName, 1 );
163 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Styles_createInstance(
164 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
166 // #110680#
167 // return (cppu::OWeakObject*)new ScXMLImport(SvXMLImportFlagsSTYLES|SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::MASTERSTYLES|SvXMLImportFlags::FONTDECLS);
168 return (cppu::OWeakObject*)new ScXMLImport( comphelper::getComponentContext(rSMgr), ScXMLImport_Styles_getImplementationName(), SvXMLImportFlags::STYLES|SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::MASTERSTYLES|SvXMLImportFlags::FONTDECLS);
171 OUString SAL_CALL ScXMLImport_Content_getImplementationName() throw()
173 return OUString( "com.sun.star.comp.Calc.XMLOasisContentImporter" );
176 uno::Sequence< OUString > SAL_CALL ScXMLImport_Content_getSupportedServiceNames() throw()
178 const OUString aServiceName( ScXMLImport_Content_getImplementationName() );
179 return uno::Sequence< OUString > ( &aServiceName, 1 );
182 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Content_createInstance(
183 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
185 // #110680#
186 // return (cppu::OWeakObject*)new ScXMLImport(SvXMLImportFlags::META|SvXMLImportFlags::STYLES|SvXMLImportFlags::MASTERSTYLES|SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::CONTENT|SvXMLImportFlags::SCRIPTS|SvXMLImportFlags::SETTINGS|SvXMLImportFlags::FONTDECLS);
187 return (cppu::OWeakObject*)new ScXMLImport( comphelper::getComponentContext(rSMgr), ScXMLImport_Content_getImplementationName(), SvXMLImportFlags::AUTOSTYLES|SvXMLImportFlags::CONTENT|SvXMLImportFlags::SCRIPTS|SvXMLImportFlags::FONTDECLS);
190 OUString SAL_CALL ScXMLImport_Settings_getImplementationName() throw()
192 return OUString( "com.sun.star.comp.Calc.XMLOasisSettingsImporter" );
195 uno::Sequence< OUString > SAL_CALL ScXMLImport_Settings_getSupportedServiceNames() throw()
197 const OUString aServiceName( ScXMLImport_Settings_getImplementationName() );
198 return uno::Sequence< OUString > ( &aServiceName, 1 );
201 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Settings_createInstance(
202 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
204 // #110680#
205 // return (cppu::OWeakObject*)new ScXMLImport(SvXMLImportFlags::SETTINGS);
206 return (cppu::OWeakObject*)new ScXMLImport( comphelper::getComponentContext(rSMgr), ScXMLImport_Settings_getImplementationName(), SvXMLImportFlags::SETTINGS );
209 const SvXMLTokenMap& ScXMLImport::GetTableRowCellAttrTokenMap()
211 static const SvXMLTokenMapEntry aTableRowCellAttrTokenMap[] =
213 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_ROW_CELL_ATTR_STYLE_NAME },
214 { XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION_NAME, XML_TOK_TABLE_ROW_CELL_ATTR_CONTENT_VALIDATION_NAME },
215 { XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_ROWS },
216 { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_COLS },
217 { XML_NAMESPACE_TABLE, XML_NUMBER_MATRIX_COLUMNS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_COLS },
218 { XML_NAMESPACE_TABLE, XML_NUMBER_MATRIX_ROWS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_ROWS },
219 { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, XML_TOK_TABLE_ROW_CELL_ATTR_REPEATED },
220 { XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE },
221 { XML_NAMESPACE_CALC_EXT, XML_VALUE_TYPE, XML_TOK_TABLE_ROW_CELL_ATTR_NEW_VALUE_TYPE },
222 { XML_NAMESPACE_OFFICE, XML_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_VALUE },
223 { XML_NAMESPACE_OFFICE, XML_DATE_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_DATE_VALUE },
224 { XML_NAMESPACE_OFFICE, XML_TIME_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_TIME_VALUE },
225 { XML_NAMESPACE_OFFICE, XML_STRING_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_STRING_VALUE },
226 { XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_BOOLEAN_VALUE },
227 { XML_NAMESPACE_TABLE, XML_FORMULA, XML_TOK_TABLE_ROW_CELL_ATTR_FORMULA },
228 { XML_NAMESPACE_OFFICE, XML_CURRENCY, XML_TOK_TABLE_ROW_CELL_ATTR_CURRENCY },
229 XML_TOKEN_MAP_END
232 if ( !pTableRowCellAttrTokenMap )
233 pTableRowCellAttrTokenMap = new SvXMLTokenMap( aTableRowCellAttrTokenMap );
234 return *pTableRowCellAttrTokenMap;
237 // NB: virtually inherit so we can multiply inherit properly
238 // in ScXMLFlatDocContext_Impl
239 class ScXMLDocContext_Impl : public virtual SvXMLImportContext
241 protected:
242 ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
244 public:
246 ScXMLDocContext_Impl( ScXMLImport& rImport,
247 sal_uInt16 nPrfx,
248 const OUString& rLName,
249 const uno::Reference<xml::sax::XAttributeList>& xAttrList );
250 virtual ~ScXMLDocContext_Impl();
252 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
253 const OUString& rLocalName,
254 const uno::Reference<xml::sax::XAttributeList>& xAttrList ) SAL_OVERRIDE;
257 ScXMLDocContext_Impl::ScXMLDocContext_Impl( ScXMLImport& rImport, sal_uInt16 nPrfx,
258 const OUString& rLName,
259 const uno::Reference<xml::sax::XAttributeList>& /* xAttrList */ ) :
260 SvXMLImportContext( rImport, nPrfx, rLName )
265 ScXMLDocContext_Impl::~ScXMLDocContext_Impl()
269 // context for flat file xml format
270 class ScXMLFlatDocContext_Impl
271 : public ScXMLDocContext_Impl, public SvXMLMetaDocumentContext
273 public:
274 ScXMLFlatDocContext_Impl( ScXMLImport& i_rImport,
275 sal_uInt16 i_nPrefix, const OUString & i_rLName,
276 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
277 const uno::Reference<document::XDocumentProperties>& i_xDocProps);
279 virtual ~ScXMLFlatDocContext_Impl();
281 virtual SvXMLImportContext *CreateChildContext(
282 sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
283 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList) SAL_OVERRIDE;
286 ScXMLFlatDocContext_Impl::ScXMLFlatDocContext_Impl( ScXMLImport& i_rImport,
287 sal_uInt16 i_nPrefix, const OUString & i_rLName,
288 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
289 const uno::Reference<document::XDocumentProperties>& i_xDocProps) :
290 SvXMLImportContext(i_rImport, i_nPrefix, i_rLName),
291 ScXMLDocContext_Impl(i_rImport, i_nPrefix, i_rLName, i_xAttrList),
292 SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName,
293 i_xDocProps)
297 ScXMLFlatDocContext_Impl::~ScXMLFlatDocContext_Impl() { }
299 SvXMLImportContext *ScXMLFlatDocContext_Impl::CreateChildContext(
300 sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
301 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList)
303 // behave like meta base class iff we encounter office:meta
304 const SvXMLTokenMap& rTokenMap = GetScImport().GetDocElemTokenMap();
305 if ( XML_TOK_DOC_META == rTokenMap.Get( i_nPrefix, i_rLocalName ) ) {
306 return SvXMLMetaDocumentContext::CreateChildContext(
307 i_nPrefix, i_rLocalName, i_xAttrList );
308 } else {
309 return ScXMLDocContext_Impl::CreateChildContext(
310 i_nPrefix, i_rLocalName, i_xAttrList );
314 class ScXMLBodyContext_Impl : public SvXMLImportContext
316 ScXMLImport& GetScImport() { return static_cast<ScXMLImport&>(GetImport()); }
318 public:
320 ScXMLBodyContext_Impl( ScXMLImport& rImport, sal_uInt16 nPrfx,
321 const OUString& rLName,
322 const uno::Reference< xml::sax::XAttributeList > & xAttrList );
323 virtual ~ScXMLBodyContext_Impl();
325 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
326 const OUString& rLocalName,
327 const uno::Reference< xml::sax::XAttributeList > & xAttrList ) SAL_OVERRIDE;
330 ScXMLBodyContext_Impl::ScXMLBodyContext_Impl( ScXMLImport& rImport,
331 sal_uInt16 nPrfx, const OUString& rLName,
332 const uno::Reference< xml::sax::XAttributeList > & /* xAttrList */ ) :
333 SvXMLImportContext( rImport, nPrfx, rLName )
337 ScXMLBodyContext_Impl::~ScXMLBodyContext_Impl()
341 SvXMLImportContext *ScXMLBodyContext_Impl::CreateChildContext(
342 sal_uInt16 /* nPrefix */,
343 const OUString& rLocalName,
344 const uno::Reference< xml::sax::XAttributeList > & xAttrList )
346 return GetScImport().CreateBodyContext( rLocalName, xAttrList );
349 SvXMLImportContext *ScXMLDocContext_Impl::CreateChildContext( sal_uInt16 nPrefix,
350 const OUString& rLocalName,
351 const uno::Reference<xml::sax::XAttributeList>& xAttrList )
353 SvXMLImportContext *pContext(0);
355 const SvXMLTokenMap& rTokenMap(GetScImport().GetDocElemTokenMap());
356 switch( rTokenMap.Get( nPrefix, rLocalName ) )
358 case XML_TOK_DOC_FONTDECLS:
359 if (GetScImport().getImportFlags() & SvXMLImportFlags::FONTDECLS)
360 pContext = GetScImport().CreateFontDeclsContext(nPrefix, rLocalName, xAttrList);
361 break;
362 case XML_TOK_DOC_STYLES:
363 if (GetScImport().getImportFlags() & SvXMLImportFlags::STYLES)
364 pContext = GetScImport().CreateStylesContext( rLocalName, xAttrList, false);
365 break;
366 case XML_TOK_DOC_AUTOSTYLES:
367 if (GetScImport().getImportFlags() & SvXMLImportFlags::AUTOSTYLES)
368 pContext = GetScImport().CreateStylesContext( rLocalName, xAttrList, true);
369 break;
370 case XML_TOK_DOC_MASTERSTYLES:
371 if (GetScImport().getImportFlags() & SvXMLImportFlags::MASTERSTYLES)
372 pContext = new ScXMLMasterStylesContext( GetImport(), nPrefix, rLocalName,
373 xAttrList );
374 break;
375 case XML_TOK_DOC_META:
376 DBG_WARNING("XML_TOK_DOC_META: should not have come here, maybe document is invalid?");
377 break;
378 case XML_TOK_DOC_SCRIPTS:
379 if (GetScImport().getImportFlags() & SvXMLImportFlags::SCRIPTS)
380 pContext = GetScImport().CreateScriptContext( rLocalName );
381 break;
382 case XML_TOK_DOC_BODY:
383 if (GetScImport().getImportFlags() & SvXMLImportFlags::CONTENT)
384 pContext = new ScXMLBodyContext_Impl( GetScImport(), nPrefix,
385 rLocalName, xAttrList );
386 break;
387 case XML_TOK_DOC_SETTINGS:
388 if (GetScImport().getImportFlags() & SvXMLImportFlags::SETTINGS)
389 pContext = new XMLDocumentSettingsContext(GetScImport(), nPrefix, rLocalName, xAttrList );
390 break;
393 if(!pContext)
394 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
396 return pContext;
399 const SvXMLTokenMap& ScXMLImport::GetDocElemTokenMap()
401 if( !pDocElemTokenMap )
403 static const SvXMLTokenMapEntry aDocTokenMap[] =
405 { XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS, XML_TOK_DOC_FONTDECLS },
406 { XML_NAMESPACE_OFFICE, XML_STYLES, XML_TOK_DOC_STYLES },
407 { XML_NAMESPACE_OFFICE, XML_AUTOMATIC_STYLES, XML_TOK_DOC_AUTOSTYLES },
408 { XML_NAMESPACE_OFFICE, XML_MASTER_STYLES, XML_TOK_DOC_MASTERSTYLES },
409 { XML_NAMESPACE_OFFICE, XML_META, XML_TOK_DOC_META },
410 { XML_NAMESPACE_OFFICE, XML_SCRIPTS, XML_TOK_DOC_SCRIPTS },
411 { XML_NAMESPACE_OFFICE, XML_BODY, XML_TOK_DOC_BODY },
412 { XML_NAMESPACE_OFFICE, XML_SETTINGS, XML_TOK_DOC_SETTINGS },
413 XML_TOKEN_MAP_END
416 pDocElemTokenMap = new SvXMLTokenMap( aDocTokenMap );
418 } // if( !pDocElemTokenMap )
420 return *pDocElemTokenMap;
423 const SvXMLTokenMap& ScXMLImport::GetBodyElemTokenMap()
425 if( !pBodyElemTokenMap )
427 static const SvXMLTokenMapEntry aBodyTokenMap[] =
429 { XML_NAMESPACE_TABLE, XML_TRACKED_CHANGES, XML_TOK_BODY_TRACKED_CHANGES },
430 { XML_NAMESPACE_TABLE, XML_CALCULATION_SETTINGS, XML_TOK_BODY_CALCULATION_SETTINGS },
431 { XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATIONS, XML_TOK_BODY_CONTENT_VALIDATIONS },
432 { XML_NAMESPACE_TABLE, XML_LABEL_RANGES, XML_TOK_BODY_LABEL_RANGES },
433 { XML_NAMESPACE_TABLE, XML_TABLE, XML_TOK_BODY_TABLE },
434 { XML_NAMESPACE_TABLE, XML_NAMED_EXPRESSIONS, XML_TOK_BODY_NAMED_EXPRESSIONS },
435 { XML_NAMESPACE_TABLE, XML_DATABASE_RANGES, XML_TOK_BODY_DATABASE_RANGES },
436 { XML_NAMESPACE_TABLE, XML_DATABASE_RANGE, XML_TOK_BODY_DATABASE_RANGE },
437 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_TABLES, XML_TOK_BODY_DATA_PILOT_TABLES },
438 { XML_NAMESPACE_TABLE, XML_CONSOLIDATION, XML_TOK_BODY_CONSOLIDATION },
439 { XML_NAMESPACE_TABLE, XML_DDE_LINKS, XML_TOK_BODY_DDE_LINKS },
440 { XML_NAMESPACE_CALC_EXT, XML_DATA_STREAM_SOURCE, XML_TOK_BODY_DATA_STREAM_SOURCE },
441 XML_TOKEN_MAP_END
444 pBodyElemTokenMap = new SvXMLTokenMap( aBodyTokenMap );
445 } // if( !pBodyElemTokenMap )
447 return *pBodyElemTokenMap;
450 const SvXMLTokenMap& ScXMLImport::GetContentValidationsElemTokenMap()
452 if( !pContentValidationsElemTokenMap )
454 static const SvXMLTokenMapEntry aContentValidationsElemTokenMap[] =
456 { XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION, XML_TOK_CONTENT_VALIDATION },
457 XML_TOKEN_MAP_END
460 pContentValidationsElemTokenMap = new SvXMLTokenMap( aContentValidationsElemTokenMap );
461 } // if( !pContentValidationsElemTokenMap )
463 return *pContentValidationsElemTokenMap;
466 const SvXMLTokenMap& ScXMLImport::GetContentValidationElemTokenMap()
468 if( !pContentValidationElemTokenMap )
470 static const SvXMLTokenMapEntry aContentValidationElemTokenMap[] =
472 { XML_NAMESPACE_TABLE, XML_HELP_MESSAGE, XML_TOK_CONTENT_VALIDATION_ELEM_HELP_MESSAGE },
473 { XML_NAMESPACE_TABLE, XML_ERROR_MESSAGE, XML_TOK_CONTENT_VALIDATION_ELEM_ERROR_MESSAGE },
474 { XML_NAMESPACE_TABLE, XML_ERROR_MACRO, XML_TOK_CONTENT_VALIDATION_ELEM_ERROR_MACRO },
475 { XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, XML_TOK_CONTENT_VALIDATION_ELEM_EVENT_LISTENERS },
476 XML_TOKEN_MAP_END
479 pContentValidationElemTokenMap = new SvXMLTokenMap( aContentValidationElemTokenMap );
480 } // if( !pContentValidationElemTokenMap )
482 return *pContentValidationElemTokenMap;
485 const SvXMLTokenMap& ScXMLImport::GetContentValidationAttrTokenMap()
487 if( !pContentValidationAttrTokenMap )
489 static const SvXMLTokenMapEntry aContentValidationAttrTokenMap[] =
491 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_CONTENT_VALIDATION_NAME },
492 { XML_NAMESPACE_TABLE, XML_CONDITION, XML_TOK_CONTENT_VALIDATION_CONDITION },
493 { XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, XML_TOK_CONTENT_VALIDATION_BASE_CELL_ADDRESS },
494 { XML_NAMESPACE_TABLE, XML_ALLOW_EMPTY_CELL, XML_TOK_CONTENT_VALIDATION_ALLOW_EMPTY_CELL },
495 { XML_NAMESPACE_TABLE, XML_DISPLAY_LIST, XML_TOK_CONTENT_VALIDATION_DISPLAY_LIST },
496 XML_TOKEN_MAP_END
499 pContentValidationAttrTokenMap = new SvXMLTokenMap( aContentValidationAttrTokenMap );
500 } // if( !pContentValidationAttrTokenMap )
502 return *pContentValidationAttrTokenMap;
505 const SvXMLTokenMap& ScXMLImport::GetContentValidationMessageElemTokenMap()
507 if( !pContentValidationMessageElemTokenMap )
509 static const SvXMLTokenMapEntry aContentValidationMessageElemTokenMap[] =
511 { XML_NAMESPACE_TEXT, XML_P, XML_TOK_P },
512 XML_TOKEN_MAP_END
515 pContentValidationMessageElemTokenMap = new SvXMLTokenMap( aContentValidationMessageElemTokenMap );
516 } // if( !pContentValidationMessageElemTokenMap )
518 return *pContentValidationMessageElemTokenMap;
521 const SvXMLTokenMap& ScXMLImport::GetContentValidationHelpMessageAttrTokenMap()
523 if( !pContentValidationHelpMessageAttrTokenMap )
525 static const SvXMLTokenMapEntry aContentValidationHelpMessageAttrTokenMap[] =
527 { XML_NAMESPACE_TABLE, XML_TITLE, XML_TOK_HELP_MESSAGE_ATTR_TITLE },
528 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_HELP_MESSAGE_ATTR_DISPLAY },
529 XML_TOKEN_MAP_END
532 pContentValidationHelpMessageAttrTokenMap = new SvXMLTokenMap( aContentValidationHelpMessageAttrTokenMap );
533 } // if( !pContentValidationHelpMessageAttrTokenMap )
535 return *pContentValidationHelpMessageAttrTokenMap;
538 const SvXMLTokenMap& ScXMLImport::GetContentValidationErrorMessageAttrTokenMap()
540 if( !pContentValidationErrorMessageAttrTokenMap )
542 static const SvXMLTokenMapEntry aContentValidationErrorMessageAttrTokenMap[] =
544 { XML_NAMESPACE_TABLE, XML_TITLE, XML_TOK_ERROR_MESSAGE_ATTR_TITLE },
545 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_ERROR_MESSAGE_ATTR_DISPLAY },
546 { XML_NAMESPACE_TABLE, XML_MESSAGE_TYPE, XML_TOK_ERROR_MESSAGE_ATTR_MESSAGE_TYPE },
547 XML_TOKEN_MAP_END
550 pContentValidationErrorMessageAttrTokenMap = new SvXMLTokenMap( aContentValidationErrorMessageAttrTokenMap );
551 } // if( !pContentValidationErrorMessageAttrTokenMap )
553 return *pContentValidationErrorMessageAttrTokenMap;
556 const SvXMLTokenMap& ScXMLImport::GetContentValidationErrorMacroAttrTokenMap()
558 if( !pContentValidationErrorMacroAttrTokenMap )
560 static const SvXMLTokenMapEntry aContentValidationErrorMacroAttrTokenMap[] =
562 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_ERROR_MACRO_ATTR_NAME },
563 { XML_NAMESPACE_TABLE, XML_EXECUTE, XML_TOK_ERROR_MACRO_ATTR_EXECUTE },
564 XML_TOKEN_MAP_END
567 pContentValidationErrorMacroAttrTokenMap = new SvXMLTokenMap( aContentValidationErrorMacroAttrTokenMap );
568 } // if( !pContentValidationErrorMacroAttrTokenMap )
570 return *pContentValidationErrorMacroAttrTokenMap;
573 const SvXMLTokenMap& ScXMLImport::GetCondFormatsTokenMap()
575 if( !pCondFormatsTokenMap )
577 static const SvXMLTokenMapEntry aCondFormatsElemTokenMap[] =
579 { XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMAT, XML_TOK_CONDFORMATS_CONDFORMAT },
580 XML_TOKEN_MAP_END
583 pCondFormatsTokenMap = new SvXMLTokenMap( aCondFormatsElemTokenMap );
586 return *pCondFormatsTokenMap;
589 const SvXMLTokenMap& ScXMLImport::GetCondFormatTokenMap()
591 if( !pCondFormatTokenMap )
593 static const SvXMLTokenMapEntry aCondFormatElemTokenMap[] =
595 { XML_NAMESPACE_CALC_EXT, XML_COLOR_SCALE, XML_TOK_CONDFORMAT_COLORSCALE },
596 { XML_NAMESPACE_CALC_EXT, XML_DATA_BAR, XML_TOK_CONDFORMAT_DATABAR },
597 { XML_NAMESPACE_CALC_EXT, XML_CONDITION, XML_TOK_CONDFORMAT_CONDITION },
598 { XML_NAMESPACE_CALC_EXT, XML_ICON_SET, XML_TOK_CONDFORMAT_ICONSET },
599 { XML_NAMESPACE_CALC_EXT, XML_DATE_IS, XML_TOK_CONDFORMAT_DATE },
600 XML_TOKEN_MAP_END
603 pCondFormatTokenMap = new SvXMLTokenMap( aCondFormatElemTokenMap );
606 return *pCondFormatTokenMap;
609 const SvXMLTokenMap& ScXMLImport::GetCondFormatAttrMap()
611 if( !pCondFormatAttrMap )
613 static const SvXMLTokenMapEntry aCondFormatAttrTokenMap[] =
615 { XML_NAMESPACE_CALC_EXT, XML_TARGET_RANGE_ADDRESS, XML_TOK_CONDFORMAT_TARGET_RANGE },
616 XML_TOKEN_MAP_END
619 pCondFormatAttrMap = new SvXMLTokenMap( aCondFormatAttrTokenMap );
622 return *pCondFormatAttrMap;
625 const SvXMLTokenMap& ScXMLImport::GetCondDateAttrMap()
627 if( !pCondDateAttrMap )
629 static const SvXMLTokenMapEntry aCondDateAttrTokenMap[] =
631 { XML_NAMESPACE_CALC_EXT, XML_DATE, XML_TOK_COND_DATE_VALUE },
632 { XML_NAMESPACE_CALC_EXT, XML_STYLE, XML_TOK_COND_DATE_STYLE },
633 XML_TOKEN_MAP_END
636 pCondDateAttrMap = new SvXMLTokenMap( aCondDateAttrTokenMap );
639 return *pCondDateAttrMap;
642 const SvXMLTokenMap& ScXMLImport::GetConditionAttrMap()
644 if( !pConditionAttrMap )
646 static const SvXMLTokenMapEntry aConditionAttrTokenMap[] =
648 { XML_NAMESPACE_CALC_EXT, XML_VALUE, XML_TOK_CONDITION_VALUE },
649 { XML_NAMESPACE_CALC_EXT, XML_APPLY_STYLE_NAME, XML_TOK_CONDITION_APPLY_STYLE_NAME },
650 { XML_NAMESPACE_CALC_EXT, XML_BASE_CELL_ADDRESS, XML_TOK_CONDITION_BASE_CELL_ADDRESS },
651 XML_TOKEN_MAP_END
654 pConditionAttrMap = new SvXMLTokenMap( aConditionAttrTokenMap );
657 return *pConditionAttrMap;
660 const SvXMLTokenMap& ScXMLImport::GetColorScaleTokenMap()
662 if( !pColorScaleTokenMap )
664 static const SvXMLTokenMapEntry aColorScaleElemTokenMap[] =
666 { XML_NAMESPACE_CALC_EXT, XML_COLOR_SCALE_ENTRY, XML_TOK_COLORSCALE_COLORSCALEENTRY },
667 XML_TOKEN_MAP_END
670 pColorScaleTokenMap = new SvXMLTokenMap( aColorScaleElemTokenMap );
673 return *pColorScaleTokenMap;
676 const SvXMLTokenMap& ScXMLImport::GetColorScaleEntryAttrMap()
678 if( !pColorScaleEntryAttrTokenMap )
680 static const SvXMLTokenMapEntry aColorScaleAttrTokenMap[] =
682 { XML_NAMESPACE_CALC_EXT, XML_TYPE, XML_TOK_COLORSCALEENTRY_TYPE },
683 { XML_NAMESPACE_CALC_EXT, XML_VALUE, XML_TOK_COLORSCALEENTRY_VALUE },
684 { XML_NAMESPACE_CALC_EXT, XML_COLOR, XML_TOK_COLORSCALEENTRY_COLOR },
685 XML_TOKEN_MAP_END
688 pColorScaleEntryAttrTokenMap = new SvXMLTokenMap( aColorScaleAttrTokenMap );
691 return *pColorScaleEntryAttrTokenMap;
694 const SvXMLTokenMap& ScXMLImport::GetFormattingTokenMap()
696 if( !pDataBarTokenMap )
698 static const SvXMLTokenMapEntry aDataBarElemTokenMap[] =
700 { XML_NAMESPACE_CALC_EXT, XML_DATA_BAR_ENTRY, XML_TOK_DATABAR_DATABARENTRY },
701 { XML_NAMESPACE_CALC_EXT, XML_FORMATTING_ENTRY, XML_TOK_FORMATTING_ENTRY },
702 XML_TOKEN_MAP_END
705 pDataBarTokenMap = new SvXMLTokenMap( aDataBarElemTokenMap );
708 return *pDataBarTokenMap;
711 const SvXMLTokenMap& ScXMLImport::GetDataBarAttrMap()
713 if( !pDataBarAttrMap )
715 static const SvXMLTokenMapEntry aDataBarAttrTokenMap[] =
717 { XML_NAMESPACE_CALC_EXT, XML_POSITIVE_COLOR, XML_TOK_DATABAR_POSITIVE_COLOR },
718 { XML_NAMESPACE_CALC_EXT, XML_NEGATIVE_COLOR, XML_TOK_DATABAR_NEGATIVE_COLOR },
719 { XML_NAMESPACE_CALC_EXT, XML_GRADIENT, XML_TOK_DATABAR_GRADIENT },
720 { XML_NAMESPACE_CALC_EXT, XML_AXIS_POSITION, XML_TOK_DATABAR_AXISPOSITION },
721 { XML_NAMESPACE_CALC_EXT, XML_SHOW_VALUE, XML_TOK_DATABAR_SHOWVALUE },
722 { XML_NAMESPACE_CALC_EXT, XML_AXIS_COLOR, XML_TOK_DATABAR_AXISCOLOR },
723 { XML_NAMESPACE_CALC_EXT, XML_MIN_LENGTH, XML_TOK_DATABAR_MINLENGTH },
724 { XML_NAMESPACE_CALC_EXT, XML_MAX_LENGTH, XML_TOK_DATABAR_MAXLENGTH },
725 XML_TOKEN_MAP_END
728 pDataBarAttrMap = new SvXMLTokenMap( aDataBarAttrTokenMap );
731 return *pDataBarAttrMap;
734 const SvXMLTokenMap& ScXMLImport::GetIconSetAttrMap()
736 if( !pIconSetAttrMap )
738 static const SvXMLTokenMapEntry aIconSetAttrTokenMap[] =
740 { XML_NAMESPACE_CALC_EXT, XML_ICON_SET_TYPE, XML_TOK_ICONSET_TYPE },
741 { XML_NAMESPACE_CALC_EXT, XML_SHOW_VALUE, XML_TOK_ICONSET_SHOWVALUE },
742 XML_TOKEN_MAP_END
745 pIconSetAttrMap = new SvXMLTokenMap( aIconSetAttrTokenMap );
748 return *pIconSetAttrMap;
751 const SvXMLTokenMap& ScXMLImport::GetDataBarEntryAttrMap()
753 if( !pFormattingEntryAttrMap )
755 static const SvXMLTokenMapEntry aDataBarAttrEntryTokenMap[] =
757 { XML_NAMESPACE_CALC_EXT, XML_TYPE, XML_TOK_DATABARENTRY_TYPE },
758 { XML_NAMESPACE_CALC_EXT, XML_VALUE, XML_TOK_DATABARENTRY_VALUE },
759 XML_TOKEN_MAP_END
762 pFormattingEntryAttrMap = new SvXMLTokenMap( aDataBarAttrEntryTokenMap );
765 return *pFormattingEntryAttrMap;
768 const SvXMLTokenMap& ScXMLImport::GetLabelRangesElemTokenMap()
770 if( !pLabelRangesElemTokenMap )
772 static const SvXMLTokenMapEntry aLabelRangesElemTokenMap[] =
774 { XML_NAMESPACE_TABLE, XML_LABEL_RANGE, XML_TOK_LABEL_RANGE_ELEM },
775 XML_TOKEN_MAP_END
778 pLabelRangesElemTokenMap = new SvXMLTokenMap( aLabelRangesElemTokenMap );
779 } // if( !pLabelRangesElemTokenMap )
781 return *pLabelRangesElemTokenMap;
784 const SvXMLTokenMap& ScXMLImport::GetLabelRangeAttrTokenMap()
786 if( !pLabelRangeAttrTokenMap )
788 static const SvXMLTokenMapEntry aLabelRangeAttrTokenMap[] =
790 { XML_NAMESPACE_TABLE, XML_LABEL_CELL_RANGE_ADDRESS, XML_TOK_LABEL_RANGE_ATTR_LABEL_RANGE },
791 { XML_NAMESPACE_TABLE, XML_DATA_CELL_RANGE_ADDRESS, XML_TOK_LABEL_RANGE_ATTR_DATA_RANGE },
792 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_LABEL_RANGE_ATTR_ORIENTATION },
793 XML_TOKEN_MAP_END
796 pLabelRangeAttrTokenMap = new SvXMLTokenMap( aLabelRangeAttrTokenMap );
797 } // if( !pLabelRangeAttrTokenMap )
799 return *pLabelRangeAttrTokenMap;
802 const SvXMLTokenMap& ScXMLImport::GetTableElemTokenMap()
804 if( !pTableElemTokenMap )
806 static const SvXMLTokenMapEntry aTableTokenMap[] =
808 { XML_NAMESPACE_TABLE, XML_NAMED_EXPRESSIONS, XML_TOK_TABLE_NAMED_EXPRESSIONS },
809 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN_GROUP, XML_TOK_TABLE_COL_GROUP },
810 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_COLUMNS, XML_TOK_TABLE_HEADER_COLS },
811 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, XML_TOK_TABLE_COLS },
812 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, XML_TOK_TABLE_COL },
813 { XML_NAMESPACE_TABLE, XML_TABLE_PROTECTION, XML_TOK_TABLE_PROTECTION },
814 { XML_NAMESPACE_LO_EXT, XML_TABLE_PROTECTION, XML_TOK_TABLE_PROTECTION_EXT },
815 { XML_NAMESPACE_OFFICE_EXT, XML_TABLE_PROTECTION, XML_TOK_TABLE_PROTECTION_EXT },
816 { XML_NAMESPACE_TABLE, XML_TABLE_ROW_GROUP, XML_TOK_TABLE_ROW_GROUP },
817 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_ROWS, XML_TOK_TABLE_HEADER_ROWS },
818 { XML_NAMESPACE_TABLE, XML_TABLE_ROWS, XML_TOK_TABLE_ROWS },
819 { XML_NAMESPACE_TABLE, XML_TABLE_ROW, XML_TOK_TABLE_ROW },
820 { XML_NAMESPACE_TABLE, XML_TABLE_SOURCE, XML_TOK_TABLE_SOURCE },
821 { XML_NAMESPACE_TABLE, XML_SCENARIO, XML_TOK_TABLE_SCENARIO },
822 { XML_NAMESPACE_TABLE, XML_SHAPES, XML_TOK_TABLE_SHAPES },
823 { XML_NAMESPACE_OFFICE, XML_FORMS, XML_TOK_TABLE_FORMS },
824 { XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, XML_TOK_TABLE_EVENT_LISTENERS },
825 { XML_NAMESPACE_OFFICE_EXT, XML_EVENT_LISTENERS, XML_TOK_TABLE_EVENT_LISTENERS_EXT },
826 { XML_NAMESPACE_CALC_EXT, XML_CONDITIONAL_FORMATS, XML_TOK_TABLE_CONDFORMATS },
827 XML_TOKEN_MAP_END
830 pTableElemTokenMap = new SvXMLTokenMap( aTableTokenMap );
831 } // if( !pTableElemTokenMap )
833 return *pTableElemTokenMap;
836 const SvXMLTokenMap& ScXMLImport::GetTableProtectionAttrTokenMap()
838 if (!pTableProtectionElemTokenMap)
840 static const SvXMLTokenMapEntry aTableProtectionTokenMap[] =
842 { XML_NAMESPACE_TABLE, XML_SELECT_PROTECTED_CELLS, XML_TOK_TABLE_SELECT_PROTECTED_CELLS },
843 { XML_NAMESPACE_TABLE, XML_SELECT_UNPROTECTED_CELLS, XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS },
844 { XML_NAMESPACE_OFFICE_EXT, XML_SELECT_PROTECTED_CELLS, XML_TOK_TABLE_SELECT_PROTECTED_CELLS_EXT },
845 { XML_NAMESPACE_LO_EXT, XML_SELECT_PROTECTED_CELLS, XML_TOK_TABLE_SELECT_PROTECTED_CELLS_EXT },
846 { XML_NAMESPACE_OFFICE_EXT, XML_SELECT_UNPROTECTED_CELLS, XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS_EXT },
847 { XML_NAMESPACE_LO_EXT, XML_SELECT_UNPROTECTED_CELLS, XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS_EXT },
848 XML_TOKEN_MAP_END
850 pTableProtectionElemTokenMap = new SvXMLTokenMap(aTableProtectionTokenMap);
853 return *pTableProtectionElemTokenMap;
856 const SvXMLTokenMap& ScXMLImport::GetTableRowsElemTokenMap()
858 if( !pTableRowsElemTokenMap )
860 static const SvXMLTokenMapEntry aTableRowsElemTokenMap[] =
862 { XML_NAMESPACE_TABLE, XML_TABLE_ROW_GROUP, XML_TOK_TABLE_ROWS_ROW_GROUP },
863 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_ROWS, XML_TOK_TABLE_ROWS_HEADER_ROWS },
864 { XML_NAMESPACE_TABLE, XML_TABLE_ROWS, XML_TOK_TABLE_ROWS_ROWS },
865 { XML_NAMESPACE_TABLE, XML_TABLE_ROW, XML_TOK_TABLE_ROWS_ROW },
866 XML_TOKEN_MAP_END
869 pTableRowsElemTokenMap = new SvXMLTokenMap( aTableRowsElemTokenMap );
870 } // if( !pTableRowsElemTokenMap )
872 return *pTableRowsElemTokenMap;
875 const SvXMLTokenMap& ScXMLImport::GetTableColsElemTokenMap()
877 if( !pTableColsElemTokenMap )
879 static const SvXMLTokenMapEntry aTableColsElemTokenMap[] =
881 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN_GROUP, XML_TOK_TABLE_COLS_COL_GROUP },
882 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_COLUMNS, XML_TOK_TABLE_COLS_HEADER_COLS },
883 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, XML_TOK_TABLE_COLS_COLS },
884 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, XML_TOK_TABLE_COLS_COL },
885 XML_TOKEN_MAP_END
888 pTableColsElemTokenMap = new SvXMLTokenMap( aTableColsElemTokenMap );
889 } // if( !pTableColsElemTokenMap )
891 return *pTableColsElemTokenMap;
894 const SvXMLTokenMap& ScXMLImport::GetTableAttrTokenMap()
896 if( !pTableAttrTokenMap )
898 static const SvXMLTokenMapEntry aTableAttrTokenMap[] =
900 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_TABLE_NAME },
901 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_STYLE_NAME },
902 { XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TOK_TABLE_PROTECTED },
903 { XML_NAMESPACE_TABLE, XML_PRINT_RANGES, XML_TOK_TABLE_PRINT_RANGES },
904 { XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, XML_TOK_TABLE_PASSWORD },
905 { XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM, XML_TOK_TABLE_PASSHASH },
906 { XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2, XML_TOK_TABLE_PASSHASH_2 },
907 { XML_NAMESPACE_LO_EXT, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2, XML_TOK_TABLE_PASSHASH_2 },
908 { XML_NAMESPACE_TABLE, XML_PRINT, XML_TOK_TABLE_PRINT },
909 XML_TOKEN_MAP_END
912 pTableAttrTokenMap = new SvXMLTokenMap( aTableAttrTokenMap );
913 } // if( !pTableAttrTokenMap )
915 return *pTableAttrTokenMap;
918 const SvXMLTokenMap& ScXMLImport::GetTableScenarioAttrTokenMap()
920 if( !pTableScenarioAttrTokenMap )
922 static const SvXMLTokenMapEntry aTableScenarioAttrTokenMap[] =
924 { XML_NAMESPACE_TABLE, XML_DISPLAY_BORDER, XML_TOK_TABLE_SCENARIO_ATTR_DISPLAY_BORDER },
925 { XML_NAMESPACE_TABLE, XML_BORDER_COLOR, XML_TOK_TABLE_SCENARIO_ATTR_BORDER_COLOR },
926 { XML_NAMESPACE_TABLE, XML_COPY_BACK, XML_TOK_TABLE_SCENARIO_ATTR_COPY_BACK },
927 { XML_NAMESPACE_TABLE, XML_COPY_STYLES, XML_TOK_TABLE_SCENARIO_ATTR_COPY_STYLES },
928 { XML_NAMESPACE_TABLE, XML_COPY_FORMULAS, XML_TOK_TABLE_SCENARIO_ATTR_COPY_FORMULAS },
929 { XML_NAMESPACE_TABLE, XML_IS_ACTIVE, XML_TOK_TABLE_SCENARIO_ATTR_IS_ACTIVE },
930 { XML_NAMESPACE_TABLE, XML_SCENARIO_RANGES, XML_TOK_TABLE_SCENARIO_ATTR_SCENARIO_RANGES },
931 { XML_NAMESPACE_TABLE, XML_COMMENT, XML_TOK_TABLE_SCENARIO_ATTR_COMMENT },
932 { XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TOK_TABLE_SCENARIO_ATTR_PROTECTED },
933 XML_TOKEN_MAP_END
936 pTableScenarioAttrTokenMap = new SvXMLTokenMap( aTableScenarioAttrTokenMap );
937 } // if( !pTableScenarioAttrTokenMap )
939 return *pTableScenarioAttrTokenMap;
942 const SvXMLTokenMap& ScXMLImport::GetTableColAttrTokenMap()
944 if( !pTableColAttrTokenMap )
946 static const SvXMLTokenMapEntry aTableColAttrTokenMap[] =
948 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_COL_ATTR_STYLE_NAME },
949 { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, XML_TOK_TABLE_COL_ATTR_REPEATED },
950 { XML_NAMESPACE_TABLE, XML_VISIBILITY, XML_TOK_TABLE_COL_ATTR_VISIBILITY },
951 { XML_NAMESPACE_TABLE, XML_DEFAULT_CELL_STYLE_NAME, XML_TOK_TABLE_COL_ATTR_DEFAULT_CELL_STYLE_NAME },
952 XML_TOKEN_MAP_END
955 pTableColAttrTokenMap = new SvXMLTokenMap( aTableColAttrTokenMap );
956 } // if( !pTableColAttrTokenMap )
958 return *pTableColAttrTokenMap;
961 const SvXMLTokenMap& ScXMLImport::GetTableRowElemTokenMap()
963 if( !pTableRowElemTokenMap )
965 static const SvXMLTokenMapEntry aTableRowTokenMap[] =
967 { XML_NAMESPACE_TABLE, XML_TABLE_CELL, XML_TOK_TABLE_ROW_CELL },
968 { XML_NAMESPACE_TABLE, XML_COVERED_TABLE_CELL, XML_TOK_TABLE_ROW_COVERED_CELL },
969 XML_TOKEN_MAP_END
972 pTableRowElemTokenMap = new SvXMLTokenMap( aTableRowTokenMap );
973 } // if( !pTableRowElemTokenMap )
975 return *pTableRowElemTokenMap;
978 const SvXMLTokenMap& ScXMLImport::GetTableRowAttrTokenMap()
980 if( !pTableRowAttrTokenMap )
982 static const SvXMLTokenMapEntry aTableRowAttrTokenMap[] =
984 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_ROW_ATTR_STYLE_NAME },
985 { XML_NAMESPACE_TABLE, XML_VISIBILITY, XML_TOK_TABLE_ROW_ATTR_VISIBILITY },
986 { XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_REPEATED, XML_TOK_TABLE_ROW_ATTR_REPEATED },
987 { XML_NAMESPACE_TABLE, XML_DEFAULT_CELL_STYLE_NAME, XML_TOK_TABLE_ROW_ATTR_DEFAULT_CELL_STYLE_NAME },
988 // { XML_NAMESPACE_TABLE, XML_USE_OPTIMAL_HEIGHT, XML_TOK_TABLE_ROW_ATTR_USE_OPTIMAL_HEIGHT },
989 XML_TOKEN_MAP_END
992 pTableRowAttrTokenMap = new SvXMLTokenMap( aTableRowAttrTokenMap );
993 } // if( !pTableRowAttrTokenMap )
995 return *pTableRowAttrTokenMap;
998 const SvXMLTokenMap& ScXMLImport::GetTableRowCellElemTokenMap()
1000 if( !pTableRowCellElemTokenMap )
1002 static const SvXMLTokenMapEntry aTableRowCellTokenMap[] =
1004 { XML_NAMESPACE_TEXT, XML_P, XML_TOK_TABLE_ROW_CELL_P },
1005 { XML_NAMESPACE_TABLE, XML_SUB_TABLE, XML_TOK_TABLE_ROW_CELL_TABLE },
1006 { XML_NAMESPACE_OFFICE, XML_ANNOTATION, XML_TOK_TABLE_ROW_CELL_ANNOTATION },
1007 { XML_NAMESPACE_TABLE, XML_DETECTIVE, XML_TOK_TABLE_ROW_CELL_DETECTIVE },
1008 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_SOURCE, XML_TOK_TABLE_ROW_CELL_CELL_RANGE_SOURCE },
1009 XML_TOKEN_MAP_END
1012 pTableRowCellElemTokenMap = new SvXMLTokenMap( aTableRowCellTokenMap );
1013 } // if( !pTableRowCellElemTokenMap )
1015 return *pTableRowCellElemTokenMap;
1018 const SvXMLTokenMap& ScXMLImport::GetTableAnnotationAttrTokenMap()
1020 if( !pTableAnnotationAttrTokenMap )
1022 static const SvXMLTokenMapEntry aTableAnnotationAttrTokenMap[] =
1024 { XML_NAMESPACE_OFFICE, XML_AUTHOR, XML_TOK_TABLE_ANNOTATION_ATTR_AUTHOR },
1025 { XML_NAMESPACE_OFFICE, XML_CREATE_DATE, XML_TOK_TABLE_ANNOTATION_ATTR_CREATE_DATE },
1026 { XML_NAMESPACE_OFFICE, XML_CREATE_DATE_STRING, XML_TOK_TABLE_ANNOTATION_ATTR_CREATE_DATE_STRING },
1027 { XML_NAMESPACE_OFFICE, XML_DISPLAY, XML_TOK_TABLE_ANNOTATION_ATTR_DISPLAY },
1028 { XML_NAMESPACE_SVG, XML_X, XML_TOK_TABLE_ANNOTATION_ATTR_X },
1029 { XML_NAMESPACE_SVG, XML_Y, XML_TOK_TABLE_ANNOTATION_ATTR_Y },
1030 XML_TOKEN_MAP_END
1033 pTableAnnotationAttrTokenMap = new SvXMLTokenMap( aTableAnnotationAttrTokenMap );
1034 } // if( !pTableAnnotationAttrTokenMap )
1036 return *pTableAnnotationAttrTokenMap;
1039 const SvXMLTokenMap& ScXMLImport::GetDetectiveElemTokenMap()
1041 if( !pDetectiveElemTokenMap )
1043 static const SvXMLTokenMapEntry aDetectiveElemTokenMap[]=
1045 { XML_NAMESPACE_TABLE, XML_HIGHLIGHTED_RANGE, XML_TOK_DETECTIVE_ELEM_HIGHLIGHTED },
1046 { XML_NAMESPACE_TABLE, XML_OPERATION, XML_TOK_DETECTIVE_ELEM_OPERATION },
1047 XML_TOKEN_MAP_END
1050 pDetectiveElemTokenMap = new SvXMLTokenMap( aDetectiveElemTokenMap );
1051 } // if( !pDetectiveElemTokenMap )
1053 return *pDetectiveElemTokenMap;
1056 const SvXMLTokenMap& ScXMLImport::GetDetectiveHighlightedAttrTokenMap()
1058 if( !pDetectiveHighlightedAttrTokenMap )
1060 static const SvXMLTokenMapEntry aDetectiveHighlightedAttrTokenMap[]=
1062 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_CELL_RANGE },
1063 { XML_NAMESPACE_TABLE, XML_DIRECTION, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_DIRECTION },
1064 { XML_NAMESPACE_TABLE, XML_CONTAINS_ERROR, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_CONTAINS_ERROR },
1065 { XML_NAMESPACE_TABLE, XML_MARKED_INVALID, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_MARKED_INVALID },
1066 XML_TOKEN_MAP_END
1069 pDetectiveHighlightedAttrTokenMap = new SvXMLTokenMap( aDetectiveHighlightedAttrTokenMap );
1070 } // if( !pDetectiveHighlightedAttrTokenMap )
1072 return *pDetectiveHighlightedAttrTokenMap;
1075 const SvXMLTokenMap& ScXMLImport::GetDetectiveOperationAttrTokenMap()
1077 if( !pDetectiveOperationAttrTokenMap )
1079 static const SvXMLTokenMapEntry aDetectiveOperationAttrTokenMap[]=
1081 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DETECTIVE_OPERATION_ATTR_NAME },
1082 { XML_NAMESPACE_TABLE, XML_INDEX, XML_TOK_DETECTIVE_OPERATION_ATTR_INDEX },
1083 XML_TOKEN_MAP_END
1086 pDetectiveOperationAttrTokenMap = new SvXMLTokenMap( aDetectiveOperationAttrTokenMap );
1087 } // if( !pDetectiveOperationAttrTokenMap )
1089 return *pDetectiveOperationAttrTokenMap;
1092 const SvXMLTokenMap& ScXMLImport::GetTableCellRangeSourceAttrTokenMap()
1094 if( !pTableCellRangeSourceAttrTokenMap )
1096 static const SvXMLTokenMapEntry aTableCellRangeSourceAttrTokenMap[] =
1098 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_NAME },
1099 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_HREF },
1100 { XML_NAMESPACE_TABLE, XML_FILTER_NAME, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_NAME },
1101 { XML_NAMESPACE_TABLE, XML_FILTER_OPTIONS, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_OPTIONS },
1102 { XML_NAMESPACE_TABLE, XML_LAST_COLUMN_SPANNED, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_COLUMN },
1103 { XML_NAMESPACE_TABLE, XML_LAST_ROW_SPANNED, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_ROW },
1104 { XML_NAMESPACE_TABLE, XML_REFRESH_DELAY, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_REFRESH_DELAY },
1105 XML_TOKEN_MAP_END
1108 pTableCellRangeSourceAttrTokenMap = new SvXMLTokenMap( aTableCellRangeSourceAttrTokenMap );
1109 } // if( !pTableCellRangeSourceAttrTokenMap )
1111 return *pTableCellRangeSourceAttrTokenMap;
1114 const SvXMLTokenMap& ScXMLImport::GetNamedExpressionsElemTokenMap()
1116 if( !pNamedExpressionsElemTokenMap )
1118 static const SvXMLTokenMapEntry aNamedExpressionsTokenMap[] =
1120 { XML_NAMESPACE_TABLE, XML_NAMED_RANGE, XML_TOK_NAMED_EXPRESSIONS_NAMED_RANGE },
1121 { XML_NAMESPACE_TABLE, XML_NAMED_EXPRESSION, XML_TOK_NAMED_EXPRESSIONS_NAMED_EXPRESSION },
1122 XML_TOKEN_MAP_END
1125 pNamedExpressionsElemTokenMap = new SvXMLTokenMap( aNamedExpressionsTokenMap );
1126 } // if( !pNamedExpressionsElemTokenMap )
1128 return *pNamedExpressionsElemTokenMap;
1131 const SvXMLTokenMap& ScXMLImport::GetNamedRangeAttrTokenMap()
1133 if( !pNamedRangeAttrTokenMap )
1135 static const SvXMLTokenMapEntry aNamedRangeAttrTokenMap[] =
1137 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_NAMED_RANGE_ATTR_NAME },
1138 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, XML_TOK_NAMED_RANGE_ATTR_CELL_RANGE_ADDRESS },
1139 { XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, XML_TOK_NAMED_RANGE_ATTR_BASE_CELL_ADDRESS },
1140 { XML_NAMESPACE_TABLE, XML_RANGE_USABLE_AS, XML_TOK_NAMED_RANGE_ATTR_RANGE_USABLE_AS },
1141 XML_TOKEN_MAP_END
1144 pNamedRangeAttrTokenMap = new SvXMLTokenMap( aNamedRangeAttrTokenMap );
1145 } // if( !pNamedRangeAttrTokenMap )
1147 return *pNamedRangeAttrTokenMap;
1150 const SvXMLTokenMap& ScXMLImport::GetNamedExpressionAttrTokenMap()
1152 if( !pNamedExpressionAttrTokenMap )
1154 static const SvXMLTokenMapEntry aNamedExpressionAttrTokenMap[] =
1156 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_NAMED_EXPRESSION_ATTR_NAME },
1157 { XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, XML_TOK_NAMED_EXPRESSION_ATTR_BASE_CELL_ADDRESS },
1158 { XML_NAMESPACE_TABLE, XML_EXPRESSION, XML_TOK_NAMED_EXPRESSION_ATTR_EXPRESSION },
1159 XML_TOKEN_MAP_END
1162 pNamedExpressionAttrTokenMap = new SvXMLTokenMap( aNamedExpressionAttrTokenMap );
1163 } // if( !pNamedExpressionAttrTokenMap )
1165 return *pNamedExpressionAttrTokenMap;
1168 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangesElemTokenMap()
1170 if( !pDatabaseRangesElemTokenMap )
1172 static const SvXMLTokenMapEntry aDatabaseRangesTokenMap[] =
1174 { XML_NAMESPACE_TABLE, XML_DATABASE_RANGE, XML_TOK_DATABASE_RANGE },
1175 XML_TOKEN_MAP_END
1178 pDatabaseRangesElemTokenMap = new SvXMLTokenMap( aDatabaseRangesTokenMap );
1179 } // if( !pDatabaseRangesElemTokenMap )
1181 return *pDatabaseRangesElemTokenMap;
1184 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeElemTokenMap()
1186 if( !pDatabaseRangeElemTokenMap )
1188 static const SvXMLTokenMapEntry aDatabaseRangeTokenMap[] =
1190 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_SQL, XML_TOK_DATABASE_RANGE_SOURCE_SQL },
1191 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_TABLE, XML_TOK_DATABASE_RANGE_SOURCE_TABLE },
1192 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_QUERY, XML_TOK_DATABASE_RANGE_SOURCE_QUERY },
1193 { XML_NAMESPACE_TABLE, XML_FILTER, XML_TOK_FILTER },
1194 { XML_NAMESPACE_TABLE, XML_SORT, XML_TOK_SORT },
1195 { XML_NAMESPACE_TABLE, XML_SUBTOTAL_RULES, XML_TOK_DATABASE_RANGE_SUBTOTAL_RULES },
1196 XML_TOKEN_MAP_END
1199 pDatabaseRangeElemTokenMap = new SvXMLTokenMap( aDatabaseRangeTokenMap );
1200 } // if( !pDatabaseRangeElemTokenMap )
1202 return *pDatabaseRangeElemTokenMap;
1205 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeAttrTokenMap()
1207 if( !pDatabaseRangeAttrTokenMap )
1209 static const SvXMLTokenMapEntry aDatabaseRangeAttrTokenMap[] =
1211 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DATABASE_RANGE_ATTR_NAME },
1212 { XML_NAMESPACE_TABLE, XML_IS_SELECTION, XML_TOK_DATABASE_RANGE_ATTR_IS_SELECTION },
1213 { XML_NAMESPACE_TABLE, XML_ON_UPDATE_KEEP_STYLES, XML_TOK_DATABASE_RANGE_ATTR_ON_UPDATE_KEEP_STYLES },
1214 { XML_NAMESPACE_TABLE, XML_ON_UPDATE_KEEP_SIZE, XML_TOK_DATABASE_RANGE_ATTR_ON_UPDATE_KEEP_SIZE },
1215 { XML_NAMESPACE_TABLE, XML_HAS_PERSISTENT_DATA, XML_TOK_DATABASE_RANGE_ATTR_HAS_PERSISTENT_DATA },
1216 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_DATABASE_RANGE_ATTR_ORIENTATION },
1217 { XML_NAMESPACE_TABLE, XML_CONTAINS_HEADER, XML_TOK_DATABASE_RANGE_ATTR_CONTAINS_HEADER },
1218 { XML_NAMESPACE_TABLE, XML_DISPLAY_FILTER_BUTTONS, XML_TOK_DATABASE_RANGE_ATTR_DISPLAY_FILTER_BUTTONS },
1219 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_DATABASE_RANGE_ATTR_TARGET_RANGE_ADDRESS },
1220 { XML_NAMESPACE_TABLE, XML_REFRESH_DELAY, XML_TOK_DATABASE_RANGE_ATTR_REFRESH_DELAY },
1221 XML_TOKEN_MAP_END
1224 pDatabaseRangeAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeAttrTokenMap );
1225 } // if( !pDatabaseRangeAttrTokenMap )
1227 return *pDatabaseRangeAttrTokenMap;
1230 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSourceSQLAttrTokenMap()
1232 if( !pDatabaseRangeSourceSQLAttrTokenMap )
1234 static const SvXMLTokenMapEntry aDatabaseRangeSourceSQLAttrTokenMap[] =
1236 { XML_NAMESPACE_TABLE, XML_DATABASE_NAME, XML_TOK_SOURCE_SQL_ATTR_DATABASE_NAME },
1237 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SOURCE_SQL_ATTR_HREF },
1238 { XML_NAMESPACE_TABLE, XML_CONNECTION_RESOURCE, XML_TOK_SOURCE_SQL_ATTR_CONNECTION_RESOURCE},
1239 { XML_NAMESPACE_TABLE, XML_SQL_STATEMENT, XML_TOK_SOURCE_SQL_ATTR_SQL_STATEMENT },
1240 { XML_NAMESPACE_TABLE, XML_PARSE_SQL_STATEMENT, XML_TOK_SOURCE_SQL_ATTR_PARSE_SQL_STATEMENT },
1241 XML_TOKEN_MAP_END
1244 pDatabaseRangeSourceSQLAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSourceSQLAttrTokenMap );
1245 } // if( !pDatabaseRangeSourceSQLAttrTokenMap )
1247 return *pDatabaseRangeSourceSQLAttrTokenMap;
1250 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSourceTableAttrTokenMap()
1252 if( !pDatabaseRangeSourceTableAttrTokenMap )
1254 static const SvXMLTokenMapEntry aDatabaseRangeSourceTableAttrTokenMap[] =
1256 { XML_NAMESPACE_TABLE, XML_DATABASE_NAME, XML_TOK_SOURCE_TABLE_ATTR_DATABASE_NAME },
1257 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SOURCE_TABLE_ATTR_HREF },
1258 { XML_NAMESPACE_TABLE, XML_CONNECTION_RESOURCE, XML_TOK_SOURCE_TABLE_ATTR_CONNECTION_RESOURCE },
1259 { XML_NAMESPACE_TABLE, XML_TABLE_NAME, XML_TOK_SOURCE_TABLE_ATTR_TABLE_NAME },
1260 { XML_NAMESPACE_TABLE, XML_DATABASE_TABLE_NAME, XML_TOK_SOURCE_TABLE_ATTR_TABLE_NAME },
1261 XML_TOKEN_MAP_END
1264 pDatabaseRangeSourceTableAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSourceTableAttrTokenMap );
1265 } // if( !pDatabaseRangeSourceTableAttrTokenMap )
1267 return *pDatabaseRangeSourceTableAttrTokenMap;
1270 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSourceQueryAttrTokenMap()
1272 if( !pDatabaseRangeSourceQueryAttrTokenMap )
1274 static const SvXMLTokenMapEntry aDatabaseRangeSourceQueryAttrTokenMap[] =
1276 { XML_NAMESPACE_TABLE, XML_DATABASE_NAME, XML_TOK_SOURCE_QUERY_ATTR_DATABASE_NAME },
1277 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SOURCE_QUERY_ATTR_HREF },
1278 { XML_NAMESPACE_TABLE, XML_CONNECTION_RESOURCE, XML_TOK_SOURCE_QUERY_ATTR_CONNECTION_RESOURCE },
1279 { XML_NAMESPACE_TABLE, XML_QUERY_NAME, XML_TOK_SOURCE_QUERY_ATTR_QUERY_NAME },
1280 XML_TOKEN_MAP_END
1283 pDatabaseRangeSourceQueryAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSourceQueryAttrTokenMap );
1284 } // if( !pDatabaseRangeSourceQueryAttrTokenMap )
1286 return *pDatabaseRangeSourceQueryAttrTokenMap;
1289 const SvXMLTokenMap& ScXMLImport::GetFilterElemTokenMap()
1291 if( !pFilterElemTokenMap )
1293 static const SvXMLTokenMapEntry aFilterTokenMap[] =
1295 { XML_NAMESPACE_TABLE, XML_FILTER_AND, XML_TOK_FILTER_AND },
1296 { XML_NAMESPACE_TABLE, XML_FILTER_OR, XML_TOK_FILTER_OR },
1297 { XML_NAMESPACE_TABLE, XML_FILTER_CONDITION, XML_TOK_FILTER_CONDITION },
1298 XML_TOKEN_MAP_END
1301 pFilterElemTokenMap = new SvXMLTokenMap( aFilterTokenMap );
1302 } // if( !pFilterElemTokenMap )
1304 return *pFilterElemTokenMap;
1307 const SvXMLTokenMap& ScXMLImport::GetFilterAttrTokenMap()
1309 if( !pFilterAttrTokenMap )
1311 static const SvXMLTokenMapEntry aFilterAttrTokenMap[] =
1313 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_FILTER_ATTR_TARGET_RANGE_ADDRESS },
1314 { XML_NAMESPACE_TABLE, XML_CONDITION_SOURCE_RANGE_ADDRESS, XML_TOK_FILTER_ATTR_CONDITION_SOURCE_RANGE_ADDRESS },
1315 { XML_NAMESPACE_TABLE, XML_CONDITION_SOURCE, XML_TOK_FILTER_ATTR_CONDITION_SOURCE },
1316 { XML_NAMESPACE_TABLE, XML_DISPLAY_DUPLICATES, XML_TOK_FILTER_ATTR_DISPLAY_DUPLICATES },
1317 XML_TOKEN_MAP_END
1320 pFilterAttrTokenMap = new SvXMLTokenMap( aFilterAttrTokenMap );
1321 } // if( !pFilterAttrTokenMap )
1323 return *pFilterAttrTokenMap;
1326 const SvXMLTokenMap& ScXMLImport::GetFilterConditionElemTokenMap()
1328 if( !pFilterConditionElemTokenMap )
1330 static const SvXMLTokenMapEntry aTokenMap[] =
1332 { XML_NAMESPACE_TABLE, XML_FILTER_SET_ITEM, XML_TOK_CONDITION_FILTER_SET_ITEM },
1333 XML_TOKEN_MAP_END
1336 pFilterConditionElemTokenMap = new SvXMLTokenMap( aTokenMap );
1339 return *pFilterConditionElemTokenMap;
1342 const SvXMLTokenMap& ScXMLImport::GetFilterConditionAttrTokenMap()
1344 if( !pFilterConditionAttrTokenMap )
1346 static const SvXMLTokenMapEntry aFilterConditionAttrTokenMap[] =
1348 { XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, XML_TOK_CONDITION_ATTR_FIELD_NUMBER },
1349 { XML_NAMESPACE_TABLE, XML_CASE_SENSITIVE, XML_TOK_CONDITION_ATTR_CASE_SENSITIVE },
1350 { XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TOK_CONDITION_ATTR_DATA_TYPE },
1351 { XML_NAMESPACE_TABLE, XML_VALUE, XML_TOK_CONDITION_ATTR_VALUE },
1352 { XML_NAMESPACE_TABLE, XML_OPERATOR, XML_TOK_CONDITION_ATTR_OPERATOR },
1353 XML_TOKEN_MAP_END
1356 pFilterConditionAttrTokenMap = new SvXMLTokenMap( aFilterConditionAttrTokenMap );
1357 } // if( !pFilterConditionAttrTokenMap )
1359 return *pFilterConditionAttrTokenMap;
1362 const SvXMLTokenMap& ScXMLImport::GetFilterSetItemAttrTokenMap()
1364 if( !pFilterSetItemAttrTokenMap )
1366 static const SvXMLTokenMapEntry aTokenMap[] =
1368 { XML_NAMESPACE_TABLE, XML_VALUE, XML_TOK_FILTER_SET_ITEM_ATTR_VALUE },
1369 XML_TOKEN_MAP_END
1372 pFilterSetItemAttrTokenMap = new SvXMLTokenMap( aTokenMap );
1375 return *pFilterSetItemAttrTokenMap;
1378 const SvXMLTokenMap& ScXMLImport::GetSortElemTokenMap()
1380 if( !pSortElemTokenMap )
1382 static const SvXMLTokenMapEntry aSortTokenMap[] =
1384 { XML_NAMESPACE_TABLE, XML_SORT_BY, XML_TOK_SORT_SORT_BY },
1385 XML_TOKEN_MAP_END
1388 pSortElemTokenMap = new SvXMLTokenMap( aSortTokenMap );
1389 } // if( !pSortElemTokenMap )
1391 return *pSortElemTokenMap;
1394 const SvXMLTokenMap& ScXMLImport::GetSortAttrTokenMap()
1396 if( !pSortAttrTokenMap )
1398 static const SvXMLTokenMapEntry aSortAttrTokenMap[] =
1400 { XML_NAMESPACE_TABLE, XML_BIND_STYLES_TO_CONTENT, XML_TOK_SORT_ATTR_BIND_STYLES_TO_CONTENT },
1401 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_SORT_ATTR_TARGET_RANGE_ADDRESS },
1402 { XML_NAMESPACE_TABLE, XML_CASE_SENSITIVE, XML_TOK_SORT_ATTR_CASE_SENSITIVE },
1403 { XML_NAMESPACE_TABLE, XML_RFC_LANGUAGE_TAG, XML_TOK_SORT_ATTR_RFC_LANGUAGE_TAG },
1404 { XML_NAMESPACE_TABLE, XML_LANGUAGE, XML_TOK_SORT_ATTR_LANGUAGE },
1405 { XML_NAMESPACE_TABLE, XML_SCRIPT, XML_TOK_SORT_ATTR_SCRIPT },
1406 { XML_NAMESPACE_TABLE, XML_COUNTRY, XML_TOK_SORT_ATTR_COUNTRY },
1407 { XML_NAMESPACE_TABLE, XML_ALGORITHM, XML_TOK_SORT_ATTR_ALGORITHM },
1408 XML_TOKEN_MAP_END
1411 pSortAttrTokenMap = new SvXMLTokenMap( aSortAttrTokenMap );
1412 } // if( !pSortAttrTokenMap )
1414 return *pSortAttrTokenMap;
1417 const SvXMLTokenMap& ScXMLImport::GetSortSortByAttrTokenMap()
1419 if( !pSortSortByAttrTokenMap )
1421 static const SvXMLTokenMapEntry aSortSortByAttrTokenMap[] =
1423 { XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, XML_TOK_SORT_BY_ATTR_FIELD_NUMBER },
1424 { XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TOK_SORT_BY_ATTR_DATA_TYPE },
1425 { XML_NAMESPACE_TABLE, XML_ORDER, XML_TOK_SORT_BY_ATTR_ORDER },
1426 XML_TOKEN_MAP_END
1429 pSortSortByAttrTokenMap = new SvXMLTokenMap( aSortSortByAttrTokenMap );
1430 } // if( !pSortSortByAttrTokenMap )
1432 return *pSortSortByAttrTokenMap;
1435 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSubTotalRulesElemTokenMap()
1437 if( !pDatabaseRangeSubTotalRulesElemTokenMap )
1439 static const SvXMLTokenMapEntry aDatabaseRangeSubTotalRulesTokenMap[] =
1441 { XML_NAMESPACE_TABLE, XML_SORT_GROUPS, XML_TOK_SUBTOTAL_RULES_SORT_GROUPS },
1442 { XML_NAMESPACE_TABLE, XML_SUBTOTAL_RULE, XML_TOK_SUBTOTAL_RULES_SUBTOTAL_RULE },
1443 XML_TOKEN_MAP_END
1446 pDatabaseRangeSubTotalRulesElemTokenMap = new SvXMLTokenMap( aDatabaseRangeSubTotalRulesTokenMap );
1447 } // if( !pDatabaseRangeSubTotalRulesElemTokenMap )
1449 return *pDatabaseRangeSubTotalRulesElemTokenMap;
1452 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSubTotalRulesAttrTokenMap()
1454 if( !pDatabaseRangeSubTotalRulesAttrTokenMap )
1456 static const SvXMLTokenMapEntry aDatabaseRangeSubTotalRulesAttrTokenMap[] =
1458 { XML_NAMESPACE_TABLE, XML_BIND_STYLES_TO_CONTENT, XML_TOK_SUBTOTAL_RULES_ATTR_BIND_STYLES_TO_CONTENT },
1459 { XML_NAMESPACE_TABLE, XML_CASE_SENSITIVE, XML_TOK_SUBTOTAL_RULES_ATTR_CASE_SENSITIVE },
1460 { XML_NAMESPACE_TABLE, XML_PAGE_BREAKS_ON_GROUP_CHANGE, XML_TOK_SUBTOTAL_RULES_ATTR_PAGE_BREAKS_ON_GROUP_CHANGE },
1461 XML_TOKEN_MAP_END
1464 pDatabaseRangeSubTotalRulesAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSubTotalRulesAttrTokenMap );
1465 } // if( !pDatabaseRangeSubTotalRulesAttrTokenMap )
1467 return *pDatabaseRangeSubTotalRulesAttrTokenMap;
1470 const SvXMLTokenMap& ScXMLImport::GetSubTotalRulesSortGroupsAttrTokenMap()
1472 if( !pSubTotalRulesSortGroupsAttrTokenMap )
1474 static const SvXMLTokenMapEntry aSubTotalRulesSortGroupsAttrTokenMap[] =
1476 { XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TOK_SORT_GROUPS_ATTR_DATA_TYPE },
1477 { XML_NAMESPACE_TABLE, XML_ORDER, XML_TOK_SORT_GROUPS_ATTR_ORDER },
1478 XML_TOKEN_MAP_END
1481 pSubTotalRulesSortGroupsAttrTokenMap = new SvXMLTokenMap( aSubTotalRulesSortGroupsAttrTokenMap );
1482 } // if( !pSubTotalRulesSortGroupsAttrTokenMap )
1484 return *pSubTotalRulesSortGroupsAttrTokenMap;
1487 const SvXMLTokenMap& ScXMLImport::GetSubTotalRulesSubTotalRuleElemTokenMap()
1489 if( !pSubTotalRulesSubTotalRuleElemTokenMap )
1491 static const SvXMLTokenMapEntry aSubTotalRulesSubTotalRuleTokenMap[] =
1493 { XML_NAMESPACE_TABLE, XML_SUBTOTAL_FIELD, XML_TOK_SUBTOTAL_RULE_SUBTOTAL_FIELD },
1494 XML_TOKEN_MAP_END
1497 pSubTotalRulesSubTotalRuleElemTokenMap = new SvXMLTokenMap( aSubTotalRulesSubTotalRuleTokenMap );
1498 } // if( !pSubTotalRulesSubTotalRuleElemTokenMap )
1500 return *pSubTotalRulesSubTotalRuleElemTokenMap;
1503 const SvXMLTokenMap& ScXMLImport::GetSubTotalRulesSubTotalRuleAttrTokenMap()
1505 if( !pSubTotalRulesSubTotalRuleAttrTokenMap )
1507 static const SvXMLTokenMapEntry aSubTotalRulesSubTotalRuleAttrTokenMap[] =
1509 { XML_NAMESPACE_TABLE, XML_GROUP_BY_FIELD_NUMBER, XML_TOK_SUBTOTAL_RULE_ATTR_GROUP_BY_FIELD_NUMBER },
1510 XML_TOKEN_MAP_END
1513 pSubTotalRulesSubTotalRuleAttrTokenMap = new SvXMLTokenMap( aSubTotalRulesSubTotalRuleAttrTokenMap );
1514 } // if( !pSubTotalRulesSubTotalRuleAttrTokenMap )
1516 return *pSubTotalRulesSubTotalRuleAttrTokenMap;
1519 const SvXMLTokenMap& ScXMLImport::GetSubTotalRuleSubTotalFieldAttrTokenMap()
1521 if( !pSubTotalRuleSubTotalFieldAttrTokenMap )
1523 static const SvXMLTokenMapEntry aSubTotalRuleSubTotalFieldAttrTokenMap[] =
1525 { XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, XML_TOK_SUBTOTAL_FIELD_ATTR_FIELD_NUMBER },
1526 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_SUBTOTAL_FIELD_ATTR_FUNCTION },
1527 XML_TOKEN_MAP_END
1530 pSubTotalRuleSubTotalFieldAttrTokenMap = new SvXMLTokenMap( aSubTotalRuleSubTotalFieldAttrTokenMap );
1531 } // if( !pSubTotalRuleSubTotalFieldAttrTokenMap )
1533 return *pSubTotalRuleSubTotalFieldAttrTokenMap;
1536 const SvXMLTokenMap& ScXMLImport::GetDataPilotTablesElemTokenMap()
1538 if( !pDataPilotTablesElemTokenMap )
1540 static const SvXMLTokenMapEntry aDataPilotTablesElemTokenMap[] =
1542 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_TABLE, XML_TOK_DATA_PILOT_TABLE },
1543 XML_TOKEN_MAP_END
1546 pDataPilotTablesElemTokenMap = new SvXMLTokenMap( aDataPilotTablesElemTokenMap );
1547 } // if( !pDataPilotTablesElemTokenMap )
1549 return *pDataPilotTablesElemTokenMap;
1552 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableAttrTokenMap()
1554 if( !pDataPilotTableAttrTokenMap )
1556 static const SvXMLTokenMapEntry aDataPilotTableAttrTokenMap[] =
1558 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DATA_PILOT_TABLE_ATTR_NAME },
1559 { XML_NAMESPACE_TABLE, XML_APPLICATION_DATA, XML_TOK_DATA_PILOT_TABLE_ATTR_APPLICATION_DATA },
1560 { XML_NAMESPACE_TABLE, XML_GRAND_TOTAL, XML_TOK_DATA_PILOT_TABLE_ATTR_GRAND_TOTAL },
1561 { XML_NAMESPACE_TABLE, XML_IGNORE_EMPTY_ROWS, XML_TOK_DATA_PILOT_TABLE_ATTR_IGNORE_EMPTY_ROWS },
1562 { XML_NAMESPACE_TABLE, XML_IDENTIFY_CATEGORIES, XML_TOK_DATA_PILOT_TABLE_ATTR_IDENTIFY_CATEGORIES },
1563 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_DATA_PILOT_TABLE_ATTR_TARGET_RANGE_ADDRESS },
1564 { XML_NAMESPACE_TABLE, XML_BUTTONS, XML_TOK_DATA_PILOT_TABLE_ATTR_BUTTONS },
1565 { XML_NAMESPACE_TABLE, XML_SHOW_FILTER_BUTTON, XML_TOK_DATA_PILOT_TABLE_ATTR_SHOW_FILTER_BUTTON },
1566 { XML_NAMESPACE_TABLE, XML_DRILL_DOWN_ON_DOUBLE_CLICK, XML_TOK_DATA_PILOT_TABLE_ATTR_DRILL_DOWN },
1567 { XML_NAMESPACE_TABLE, XML_HEADER_GRID_LAYOUT, XML_TOK_DATA_PILOT_TABLE_ATTR_HEADER_GRID_LAYOUT },
1568 XML_TOKEN_MAP_END
1571 pDataPilotTableAttrTokenMap = new SvXMLTokenMap( aDataPilotTableAttrTokenMap );
1572 } // if( !pDataPilotTableAttrTokenMap )
1574 return *pDataPilotTableAttrTokenMap;
1577 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableElemTokenMap()
1579 if( !pDataPilotTableElemTokenMap )
1581 static const SvXMLTokenMapEntry aDataPilotTableElemTokenMap[] =
1583 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_SQL, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_SQL },
1584 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_TABLE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_TABLE },
1585 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_GRAND_TOTAL, XML_TOK_DATA_PILOT_TABLE_ELEM_GRAND_TOTAL },
1586 { XML_NAMESPACE_TABLE_EXT, XML_DATA_PILOT_GRAND_TOTAL, XML_TOK_DATA_PILOT_TABLE_ELEM_GRAND_TOTAL_EXT },
1587 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_QUERY, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_QUERY },
1588 { XML_NAMESPACE_TABLE, XML_SOURCE_SERVICE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_SERVICE },
1589 { XML_NAMESPACE_TABLE, XML_SOURCE_CELL_RANGE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_CELL_RANGE },
1590 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_FIELD, XML_TOK_DATA_PILOT_TABLE_ELEM_DATA_PILOT_FIELD },
1591 XML_TOKEN_MAP_END
1594 pDataPilotTableElemTokenMap = new SvXMLTokenMap( aDataPilotTableElemTokenMap );
1595 } // if( !pDataPilotTableElemTokenMap )
1597 return *pDataPilotTableElemTokenMap;
1600 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableSourceServiceAttrTokenMap()
1602 if( !pDataPilotTableSourceServiceAttrTokenMap )
1604 static const SvXMLTokenMapEntry aDataPilotTableSourceServiceAttrTokenMap[] =
1606 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_SOURCE_SERVICE_ATTR_NAME },
1607 { XML_NAMESPACE_TABLE, XML_SOURCE_NAME, XML_TOK_SOURCE_SERVICE_ATTR_SOURCE_NAME },
1608 { XML_NAMESPACE_TABLE, XML_OBJECT_NAME, XML_TOK_SOURCE_SERVICE_ATTR_OBJECT_NAME },
1609 { XML_NAMESPACE_TABLE, XML_USER_NAME, XML_TOK_SOURCE_SERVICE_ATTR_USER_NAME },
1610 { XML_NAMESPACE_TABLE, XML_PASSWORD, XML_TOK_SOURCE_SERVICE_ATTR_PASSWORD },
1611 XML_TOKEN_MAP_END
1614 pDataPilotTableSourceServiceAttrTokenMap = new SvXMLTokenMap( aDataPilotTableSourceServiceAttrTokenMap );
1615 } // if( !pDataPilotTableSourceServiceAttrTokenMap )
1617 return *pDataPilotTableSourceServiceAttrTokenMap;
1620 const SvXMLTokenMap& ScXMLImport::GetDataPilotGrandTotalAttrTokenMap()
1622 if (!pDataPilotGrandTotalAttrTokenMap)
1624 static const SvXMLTokenMapEntry aDataPilotGrandTotalAttrTokenMap[] =
1626 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_DATA_PILOT_GRAND_TOTAL_ATTR_DISPLAY },
1627 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_DATA_PILOT_GRAND_TOTAL_ATTR_ORIENTATION },
1628 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_GRAND_TOTAL_ATTR_DISPLAY_NAME },
1629 { XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_GRAND_TOTAL_ATTR_DISPLAY_NAME_EXT },
1630 XML_TOKEN_MAP_END
1633 pDataPilotGrandTotalAttrTokenMap = new SvXMLTokenMap( aDataPilotGrandTotalAttrTokenMap );
1636 return *pDataPilotGrandTotalAttrTokenMap;
1639 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableSourceCellRangeAttrTokenMap()
1641 if( !pDataPilotTableSourceCellRangeAttrTokenMap )
1643 static const SvXMLTokenMapEntry aDataPilotTableSourceCellRangeAttrTokenMap[] =
1645 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, XML_TOK_SOURCE_CELL_RANGE_ATTR_CELL_RANGE_ADDRESS },
1646 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_SOURCE_CELL_RANGE_ATTR_NAME },
1647 XML_TOKEN_MAP_END
1650 pDataPilotTableSourceCellRangeAttrTokenMap = new SvXMLTokenMap( aDataPilotTableSourceCellRangeAttrTokenMap );
1651 } // if( !pDataPilotTableSourceCellRangeAttrTokenMap )
1653 return *pDataPilotTableSourceCellRangeAttrTokenMap;
1656 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableSourceCellRangeElemTokenMap()
1658 if( !pDataPilotTableSourceCellRangeElemTokenMap )
1660 static const SvXMLTokenMapEntry aDataPilotTableSourceCellRangeElemTokenMap[] =
1662 { XML_NAMESPACE_TABLE, XML_FILTER, XML_TOK_SOURCE_CELL_RANGE_ELEM_FILTER},
1663 XML_TOKEN_MAP_END
1666 pDataPilotTableSourceCellRangeElemTokenMap = new SvXMLTokenMap( aDataPilotTableSourceCellRangeElemTokenMap );
1667 } // if( !pDataPilotTableSourceCellRangeElemTokenMap )
1669 return *pDataPilotTableSourceCellRangeElemTokenMap;
1672 const SvXMLTokenMap& ScXMLImport::GetDataPilotFieldAttrTokenMap()
1674 if( !pDataPilotFieldAttrTokenMap )
1676 static const SvXMLTokenMapEntry aDataPilotFieldAttrTokenMap[] =
1678 { XML_NAMESPACE_TABLE, XML_SOURCE_FIELD_NAME, XML_TOK_DATA_PILOT_FIELD_ATTR_SOURCE_FIELD_NAME },
1679 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_FIELD_ATTR_DISPLAY_NAME },
1680 { XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_FIELD_ATTR_DISPLAY_NAME_EXT },
1681 { XML_NAMESPACE_TABLE, XML_IS_DATA_LAYOUT_FIELD, XML_TOK_DATA_PILOT_FIELD_ATTR_IS_DATA_LAYOUT_FIELD },
1682 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_DATA_PILOT_FIELD_ATTR_FUNCTION },
1683 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_DATA_PILOT_FIELD_ATTR_ORIENTATION },
1684 { XML_NAMESPACE_TABLE, XML_SELECTED_PAGE, XML_TOK_DATA_PILOT_FIELD_ATTR_SELECTED_PAGE },
1685 { XML_NAMESPACE_LO_EXT, XML_IGNORE_SELECTED_PAGE, XML_TOK_DATA_PILOT_FIELD_ATTR_IGNORE_SELECTED_PAGE },
1686 { XML_NAMESPACE_TABLE, XML_USED_HIERARCHY, XML_TOK_DATA_PILOT_FIELD_ATTR_USED_HIERARCHY },
1687 XML_TOKEN_MAP_END
1690 pDataPilotFieldAttrTokenMap = new SvXMLTokenMap( aDataPilotFieldAttrTokenMap );
1691 } // if( !pDataPilotFieldAttrTokenMap )
1693 return *pDataPilotFieldAttrTokenMap;
1696 const SvXMLTokenMap& ScXMLImport::GetDataPilotFieldElemTokenMap()
1698 if( !pDataPilotFieldElemTokenMap )
1700 static const SvXMLTokenMapEntry aDataPilotFieldElemTokenMap[] =
1702 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_LEVEL, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_LEVEL },
1703 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_FIELD_REFERENCE, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_REFERENCE },
1704 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUPS, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_GROUPS },
1705 XML_TOKEN_MAP_END
1708 pDataPilotFieldElemTokenMap = new SvXMLTokenMap( aDataPilotFieldElemTokenMap );
1709 } // if( !pDataPilotFieldElemTokenMap )
1711 return *pDataPilotFieldElemTokenMap;
1714 const SvXMLTokenMap& ScXMLImport::GetDataPilotLevelAttrTokenMap()
1716 if( !pDataPilotLevelAttrTokenMap )
1718 static const SvXMLTokenMapEntry aDataPilotLevelAttrTokenMap[] =
1720 { XML_NAMESPACE_TABLE, XML_SHOW_EMPTY, XML_TOK_DATA_PILOT_LEVEL_ATTR_SHOW_EMPTY },
1721 { XML_NAMESPACE_CALC_EXT, XML_REPEAT_ITEM_LABELS, XML_TOK_DATA_PILOT_LEVEL_ATTR_REPEAT_ITEM_LABELS },
1722 XML_TOKEN_MAP_END
1725 pDataPilotLevelAttrTokenMap = new SvXMLTokenMap( aDataPilotLevelAttrTokenMap );
1726 } // if( !pDataPilotLevelAttrTokenMap )
1728 return *pDataPilotLevelAttrTokenMap;
1731 const SvXMLTokenMap& ScXMLImport::GetDataPilotLevelElemTokenMap()
1733 if( !pDataPilotLevelElemTokenMap )
1735 static const SvXMLTokenMapEntry aDataPilotLevelElemTokenMap[] =
1737 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_SUBTOTALS, XML_TOK_DATA_PILOT_LEVEL_ELEM_DATA_PILOT_SUBTOTALS },
1738 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_MEMBERS, XML_TOK_DATA_PILOT_LEVEL_ELEM_DATA_PILOT_MEMBERS },
1739 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_DISPLAY_INFO, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_DISPLAY_INFO },
1740 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_SORT_INFO, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_SORT_INFO },
1741 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_LAYOUT_INFO, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_LAYOUT_INFO },
1742 XML_TOKEN_MAP_END
1745 pDataPilotLevelElemTokenMap = new SvXMLTokenMap( aDataPilotLevelElemTokenMap );
1746 } // if( !pDataPilotLevelElemTokenMap )
1748 return *pDataPilotLevelElemTokenMap;
1751 const SvXMLTokenMap& ScXMLImport::GetDataPilotSubTotalsElemTokenMap()
1753 if( !pDataPilotSubTotalsElemTokenMap )
1755 static const SvXMLTokenMapEntry aDataPilotSubTotalsElemTokenMap[] =
1757 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_SUBTOTAL, XML_TOK_DATA_PILOT_SUBTOTALS_ELEM_DATA_PILOT_SUBTOTAL },
1758 XML_TOKEN_MAP_END
1761 pDataPilotSubTotalsElemTokenMap = new SvXMLTokenMap( aDataPilotSubTotalsElemTokenMap );
1762 } // if( !pDataPilotSubTotalsElemTokenMap )
1764 return *pDataPilotSubTotalsElemTokenMap;
1767 const SvXMLTokenMap& ScXMLImport::GetDataPilotSubTotalAttrTokenMap()
1769 if( !pDataPilotSubTotalAttrTokenMap )
1771 static const SvXMLTokenMapEntry aDataPilotSubTotalAttrTokenMap[] =
1773 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_DATA_PILOT_SUBTOTAL_ATTR_FUNCTION },
1774 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_SUBTOTAL_ATTR_DISPLAY_NAME },
1775 { XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_SUBTOTAL_ATTR_DISPLAY_NAME_EXT },
1776 XML_TOKEN_MAP_END
1779 pDataPilotSubTotalAttrTokenMap = new SvXMLTokenMap( aDataPilotSubTotalAttrTokenMap );
1780 } // if( !pDataPilotSubTotalAttrTokenMap )
1782 return *pDataPilotSubTotalAttrTokenMap;
1785 const SvXMLTokenMap& ScXMLImport::GetDataPilotMembersElemTokenMap()
1787 if( !pDataPilotMembersElemTokenMap )
1789 static const SvXMLTokenMapEntry aDataPilotMembersElemTokenMap[] =
1791 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_MEMBER, XML_TOK_DATA_PILOT_MEMBERS_ELEM_DATA_PILOT_MEMBER },
1792 XML_TOKEN_MAP_END
1795 pDataPilotMembersElemTokenMap = new SvXMLTokenMap( aDataPilotMembersElemTokenMap );
1796 } // if( !pDataPilotMembersElemTokenMap )
1798 return *pDataPilotMembersElemTokenMap;
1801 const SvXMLTokenMap& ScXMLImport::GetDataPilotMemberAttrTokenMap()
1803 if( !pDataPilotMemberAttrTokenMap )
1805 static const SvXMLTokenMapEntry aDataPilotMemberAttrTokenMap[] =
1807 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DATA_PILOT_MEMBER_ATTR_NAME },
1808 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_MEMBER_ATTR_DISPLAY_NAME },
1809 { XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_MEMBER_ATTR_DISPLAY_NAME_EXT },
1810 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_DATA_PILOT_MEMBER_ATTR_DISPLAY },
1811 { XML_NAMESPACE_TABLE, XML_SHOW_DETAILS, XML_TOK_DATA_PILOT_MEMBER_ATTR_SHOW_DETAILS },
1812 XML_TOKEN_MAP_END
1815 pDataPilotMemberAttrTokenMap = new SvXMLTokenMap( aDataPilotMemberAttrTokenMap );
1816 } // if( !pDataPilotMemberAttrTokenMap )
1818 return *pDataPilotMemberAttrTokenMap;
1821 const SvXMLTokenMap& ScXMLImport::GetConsolidationAttrTokenMap()
1823 if( !pConsolidationAttrTokenMap )
1825 static const SvXMLTokenMapEntry aConsolidationAttrTokenMap[] =
1827 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_CONSOLIDATION_ATTR_FUNCTION },
1828 { XML_NAMESPACE_TABLE, XML_SOURCE_CELL_RANGE_ADDRESSES, XML_TOK_CONSOLIDATION_ATTR_SOURCE_RANGES },
1829 { XML_NAMESPACE_TABLE, XML_TARGET_CELL_ADDRESS, XML_TOK_CONSOLIDATION_ATTR_TARGET_ADDRESS },
1830 { XML_NAMESPACE_TABLE, XML_USE_LABEL, XML_TOK_CONSOLIDATION_ATTR_USE_LABEL },
1831 { XML_NAMESPACE_TABLE, XML_LINK_TO_SOURCE_DATA, XML_TOK_CONSOLIDATION_ATTR_LINK_TO_SOURCE },
1832 XML_TOKEN_MAP_END
1835 pConsolidationAttrTokenMap = new SvXMLTokenMap( aConsolidationAttrTokenMap );
1836 } // if( !pConsolidationAttrTokenMap )
1838 return *pConsolidationAttrTokenMap;
1841 const SvXMLTokenMap& ScXMLImport::GetCellTextParaElemTokenMap()
1843 if (!pCellTextParaElemTokenMap)
1845 static const SvXMLTokenMapEntry aMap[] =
1847 { XML_NAMESPACE_TEXT, XML_S, XML_TOK_CELL_TEXT_S },
1848 { XML_NAMESPACE_TEXT, XML_SPAN, XML_TOK_CELL_TEXT_SPAN },
1849 { XML_NAMESPACE_TEXT, XML_SHEET_NAME, XML_TOK_CELL_TEXT_SHEET_NAME },
1850 { XML_NAMESPACE_TEXT, XML_DATE, XML_TOK_CELL_TEXT_DATE },
1851 { XML_NAMESPACE_TEXT, XML_TITLE, XML_TOK_CELL_TEXT_TITLE },
1852 { XML_NAMESPACE_TEXT, XML_A, XML_TOK_CELL_TEXT_URL },
1853 XML_TOKEN_MAP_END
1856 pCellTextParaElemTokenMap = new SvXMLTokenMap(aMap);
1858 return *pCellTextParaElemTokenMap;
1861 const SvXMLTokenMap& ScXMLImport::GetCellTextSpanElemTokenMap()
1863 if (!pCellTextSpanElemTokenMap)
1865 static const SvXMLTokenMapEntry aMap[] =
1867 { XML_NAMESPACE_TEXT, XML_SHEET_NAME, XML_TOK_CELL_TEXT_SPAN_ELEM_SHEET_NAME },
1868 { XML_NAMESPACE_TEXT, XML_DATE, XML_TOK_CELL_TEXT_SPAN_ELEM_DATE },
1869 { XML_NAMESPACE_TEXT, XML_TITLE, XML_TOK_CELL_TEXT_SPAN_ELEM_TITLE },
1870 { XML_NAMESPACE_TEXT, XML_A, XML_TOK_CELL_TEXT_SPAN_ELEM_URL },
1871 { XML_NAMESPACE_TEXT, XML_S, XML_TOK_CELL_TEXT_SPAN_ELEM_S },
1872 XML_TOKEN_MAP_END
1875 pCellTextSpanElemTokenMap = new SvXMLTokenMap(aMap);
1877 return *pCellTextSpanElemTokenMap;
1880 const SvXMLTokenMap& ScXMLImport::GetCellTextSpanAttrTokenMap()
1882 if (!pCellTextSpanAttrTokenMap)
1884 static const SvXMLTokenMapEntry aMap[] =
1886 { XML_NAMESPACE_TEXT, XML_STYLE_NAME, XML_TOK_CELL_TEXT_SPAN_ATTR_STYLE_NAME },
1887 XML_TOKEN_MAP_END
1890 pCellTextSpanAttrTokenMap = new SvXMLTokenMap(aMap);
1892 return *pCellTextSpanAttrTokenMap;
1895 const SvXMLTokenMap& ScXMLImport::GetCellTextURLAttrTokenMap()
1897 if (!pCellTextURLAttrTokenMap)
1899 static const SvXMLTokenMapEntry aMap[] =
1901 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_CELL_TEXT_URL_ATTR_UREF },
1902 { XML_NAMESPACE_XLINK, XML_TYPE, XML_TOK_CELL_TEXT_URL_ATTR_TYPE },
1903 XML_TOKEN_MAP_END
1906 pCellTextURLAttrTokenMap = new SvXMLTokenMap(aMap);
1908 return *pCellTextURLAttrTokenMap;
1911 const SvXMLTokenMap& ScXMLImport::GetCellTextSAttrTokenMap()
1913 if (!pCellTextSAttrTokenMap)
1915 static const SvXMLTokenMapEntry aMap[] =
1917 { XML_NAMESPACE_TEXT, XML_C, XML_TOK_CELL_TEXT_S_ATTR_C },
1918 XML_TOKEN_MAP_END
1921 pCellTextSAttrTokenMap = new SvXMLTokenMap(aMap);
1923 return *pCellTextSAttrTokenMap;
1926 const SvXMLTokenMap& ScXMLImport::GetDataStreamAttrTokenMap()
1928 if (!pDataStreamAttrTokenMap)
1930 static const SvXMLTokenMapEntry aMap[] =
1932 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_DATA_STREAM_ATTR_URL },
1933 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_DATA_STREAM_ATTR_RANGE },
1934 { XML_NAMESPACE_CALC_EXT, XML_EMPTY_LINE_REFRESH, XML_TOK_DATA_STREAM_ATTR_EMPTY_LINE_REFRESH },
1935 { XML_NAMESPACE_CALC_EXT, XML_INSERTION_POSITION, XML_TOK_DATA_STREAM_ATTR_INSERTION_POSITION },
1936 XML_TOKEN_MAP_END
1938 pDataStreamAttrTokenMap = new SvXMLTokenMap(aMap);
1940 return *pDataStreamAttrTokenMap;
1943 void ScXMLImport::SetPostProcessData( sc::ImportPostProcessData* p )
1945 mpPostProcessData = p;
1948 sc::PivotTableSources& ScXMLImport::GetPivotTableSources()
1950 if (!mpPivotSources)
1951 mpPivotSources.reset(new sc::PivotTableSources);
1953 return *mpPivotSources;
1956 SvXMLImportContext *ScXMLImport::CreateContext( sal_uInt16 nPrefix,
1957 const OUString& rLocalName,
1958 const uno::Reference<xml::sax::XAttributeList>& xAttrList )
1960 SvXMLImportContext *pContext = 0;
1962 if( (XML_NAMESPACE_OFFICE == nPrefix) &&
1963 ( IsXMLToken(rLocalName, XML_DOCUMENT_STYLES) ||
1964 IsXMLToken(rLocalName, XML_DOCUMENT_CONTENT) ||
1965 IsXMLToken(rLocalName, XML_DOCUMENT_SETTINGS) )) {
1966 pContext = new ScXMLDocContext_Impl( *this, nPrefix, rLocalName,
1967 xAttrList );
1968 } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
1969 ( IsXMLToken(rLocalName, XML_DOCUMENT_META)) ) {
1970 pContext = CreateMetaContext(rLocalName);
1971 } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
1972 ( IsXMLToken(rLocalName, XML_DOCUMENT)) ) {
1973 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1974 GetModel(), uno::UNO_QUERY_THROW);
1975 // flat OpenDocument file format
1976 pContext = new ScXMLFlatDocContext_Impl( *this, nPrefix, rLocalName,
1977 xAttrList, xDPS->getDocumentProperties());
1979 else
1980 pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
1982 return pContext;
1985 ScXMLImport::ScXMLImport(
1986 const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rContext,
1987 OUString const & implementationName, SvXMLImportFlags nImportFlag)
1988 : SvXMLImport( rContext, implementationName, nImportFlag ),
1989 pDoc( NULL ),
1990 pChangeTrackingImportHelper(NULL),
1991 pStylesImportHelper(NULL),
1992 sNumberFormat(SC_UNONAME_NUMFMT),
1993 sLocale(SC_LOCALE),
1994 sCellStyle(SC_UNONAME_CELLSTYL),
1995 sStandardFormat(SC_STANDARDFORMAT),
1996 sType(SC_UNONAME_TYPE),
1997 pDocElemTokenMap( 0 ),
1998 pStylesElemTokenMap( 0 ),
1999 pStylesAttrTokenMap( 0 ),
2000 pStyleElemTokenMap( 0 ),
2001 pBodyElemTokenMap( 0 ),
2002 pContentValidationsElemTokenMap( 0 ),
2003 pContentValidationElemTokenMap( 0 ),
2004 pContentValidationAttrTokenMap( 0 ),
2005 pContentValidationMessageElemTokenMap( 0 ),
2006 pContentValidationHelpMessageAttrTokenMap( 0 ),
2007 pContentValidationErrorMessageAttrTokenMap( 0 ),
2008 pContentValidationErrorMacroAttrTokenMap( 0 ),
2009 pCondFormatsTokenMap( 0 ),
2010 pCondFormatTokenMap( 0 ),
2011 pCondFormatAttrMap( 0 ),
2012 pCondDateAttrMap( 0 ),
2013 pConditionAttrMap( 0 ),
2014 pColorScaleTokenMap( 0 ),
2015 pColorScaleEntryAttrTokenMap( 0 ),
2016 pDataBarTokenMap( 0 ),
2017 pDataBarAttrMap( 0 ),
2018 pFormattingEntryAttrMap( 0 ),
2019 pIconSetAttrMap( 0 ),
2020 pLabelRangesElemTokenMap( 0 ),
2021 pLabelRangeAttrTokenMap( 0 ),
2022 pTableElemTokenMap( 0 ),
2023 pTableProtectionElemTokenMap(NULL),
2024 pTableRowsElemTokenMap( 0 ),
2025 pTableColsElemTokenMap( 0 ),
2026 pTableScenarioAttrTokenMap( 0 ),
2027 pTableAttrTokenMap( 0 ),
2028 pTableColAttrTokenMap( 0 ),
2029 pTableRowElemTokenMap( 0 ),
2030 pTableRowAttrTokenMap( 0 ),
2031 pTableRowCellElemTokenMap( 0 ),
2032 pTableRowCellAttrTokenMap( 0 ),
2033 pTableAnnotationAttrTokenMap( 0 ),
2034 pDetectiveElemTokenMap( 0 ),
2035 pDetectiveHighlightedAttrTokenMap( 0 ),
2036 pDetectiveOperationAttrTokenMap( 0 ),
2037 pTableCellRangeSourceAttrTokenMap( 0 ),
2038 pNamedExpressionsElemTokenMap( 0 ),
2039 pNamedRangeAttrTokenMap( 0 ),
2040 pNamedExpressionAttrTokenMap( 0 ),
2041 pDatabaseRangesElemTokenMap( 0 ),
2042 pDatabaseRangeElemTokenMap( 0 ),
2043 pDatabaseRangeAttrTokenMap( 0 ),
2044 pDatabaseRangeSourceSQLAttrTokenMap( 0 ),
2045 pDatabaseRangeSourceTableAttrTokenMap( 0 ),
2046 pDatabaseRangeSourceQueryAttrTokenMap( 0 ),
2047 pFilterElemTokenMap( 0 ),
2048 pFilterAttrTokenMap( 0 ),
2049 pFilterConditionElemTokenMap( 0 ),
2050 pFilterConditionAttrTokenMap( 0 ),
2051 pFilterSetItemAttrTokenMap( 0 ),
2052 pSortElemTokenMap( 0 ),
2053 pSortAttrTokenMap( 0 ),
2054 pSortSortByAttrTokenMap( 0 ),
2055 pDatabaseRangeSubTotalRulesElemTokenMap( 0 ),
2056 pDatabaseRangeSubTotalRulesAttrTokenMap( 0 ),
2057 pSubTotalRulesSortGroupsAttrTokenMap( 0 ),
2058 pSubTotalRulesSubTotalRuleElemTokenMap( 0 ),
2059 pSubTotalRulesSubTotalRuleAttrTokenMap( 0 ),
2060 pSubTotalRuleSubTotalFieldAttrTokenMap( 0 ),
2061 pDataPilotTablesElemTokenMap( 0 ),
2062 pDataPilotTableAttrTokenMap( 0 ),
2063 pDataPilotTableElemTokenMap( 0 ),
2064 pDataPilotTableSourceServiceAttrTokenMap( 0 ),
2065 pDataPilotGrandTotalAttrTokenMap(NULL),
2066 pDataPilotTableSourceCellRangeElemTokenMap( 0 ),
2067 pDataPilotTableSourceCellRangeAttrTokenMap( 0 ),
2068 pDataPilotFieldAttrTokenMap( 0 ),
2069 pDataPilotFieldElemTokenMap( 0 ),
2070 pDataPilotLevelAttrTokenMap( 0 ),
2071 pDataPilotLevelElemTokenMap( 0 ),
2072 pDataPilotSubTotalsElemTokenMap( 0 ),
2073 pDataPilotSubTotalAttrTokenMap( 0 ),
2074 pDataPilotMembersElemTokenMap( 0 ),
2075 pDataPilotMemberAttrTokenMap( 0 ),
2076 pConsolidationAttrTokenMap( 0 ),
2077 pCellTextParaElemTokenMap(NULL),
2078 pCellTextSpanElemTokenMap(NULL),
2079 pCellTextSpanAttrTokenMap(NULL),
2080 pCellTextURLAttrTokenMap(NULL),
2081 pCellTextSAttrTokenMap(NULL),
2082 pDataStreamAttrTokenMap(NULL),
2083 mpPostProcessData(NULL),
2084 aTables(*this),
2085 pMyNamedExpressions(NULL),
2086 pMyLabelRanges(NULL),
2087 pValidations(NULL),
2088 pDetectiveOpArray(NULL),
2089 pSolarMutexGuard(NULL),
2090 pNumberFormatAttributesExportHelper(NULL),
2091 pStyleNumberFormats(NULL),
2092 sPrevStyleName(),
2093 sPrevCurrency(),
2094 nSolarMutexLocked(0),
2095 nProgressCount(0),
2096 nStyleFamilyMask( 0 ),
2097 nPrevCellType(0),
2098 bLoadDoc( true ),
2099 bRemoveLastChar(false),
2100 bNullDateSetted(false),
2101 bSelfImportingXMLSet(false),
2102 mbLockSolarMutex(true),
2103 mbImportStyles(true),
2104 mbHasNewCondFormatData(false)
2106 pStylesImportHelper = new ScMyStylesImportHelper(*this);
2108 xScPropHdlFactory = new XMLScPropHdlFactory;
2109 xCellStylesPropertySetMapper = new XMLPropertySetMapper(aXMLScCellStylesProperties, xScPropHdlFactory, false);
2110 xColumnStylesPropertySetMapper = new XMLPropertySetMapper(aXMLScColumnStylesProperties, xScPropHdlFactory, false);
2111 xRowStylesPropertySetMapper = new XMLPropertySetMapper(aXMLScRowStylesImportProperties, xScPropHdlFactory, false);
2112 xTableStylesPropertySetMapper = new XMLPropertySetMapper(aXMLScTableStylesImportProperties, xScPropHdlFactory, false);
2114 // #i66550# needed for 'presentation:event-listener' element for URLs in shapes
2115 GetNamespaceMap().Add(
2116 GetXMLToken( XML_NP_PRESENTATION ),
2117 GetXMLToken( XML_N_PRESENTATION ),
2118 XML_NAMESPACE_PRESENTATION );
2120 // initialize cell type map.
2121 const struct { XMLTokenEnum _token; sal_Int16 _type; } aCellTypePairs[] =
2123 { XML_FLOAT, util::NumberFormat::NUMBER },
2124 { XML_STRING, util::NumberFormat::TEXT },
2125 { XML_TIME, util::NumberFormat::TIME },
2126 { XML_DATE, util::NumberFormat::DATETIME },
2127 { XML_PERCENTAGE, util::NumberFormat::PERCENT },
2128 { XML_CURRENCY, util::NumberFormat::CURRENCY },
2129 { XML_BOOLEAN, util::NumberFormat::LOGICAL }
2131 size_t n = sizeof(aCellTypePairs)/sizeof(aCellTypePairs[0]);
2132 for (size_t i = 0; i < n; ++i)
2134 aCellTypeMap.insert(
2135 CellTypeMap::value_type(
2136 GetXMLToken(aCellTypePairs[i]._token), aCellTypePairs[i]._type));
2140 ScXMLImport::~ScXMLImport() throw()
2142 // delete pI18NMap;
2143 delete pDocElemTokenMap;
2144 delete pStylesElemTokenMap;
2145 delete pStylesAttrTokenMap;
2146 delete pStyleElemTokenMap;
2147 delete pBodyElemTokenMap;
2148 delete pContentValidationsElemTokenMap;
2149 delete pContentValidationElemTokenMap;
2150 delete pContentValidationAttrTokenMap;
2151 delete pContentValidationMessageElemTokenMap;
2152 delete pContentValidationHelpMessageAttrTokenMap;
2153 delete pContentValidationErrorMessageAttrTokenMap;
2154 delete pContentValidationErrorMacroAttrTokenMap;
2155 delete pCondFormatsTokenMap;
2156 delete pCondFormatTokenMap;
2157 delete pCondFormatAttrMap;
2158 delete pCondDateAttrMap;
2159 delete pConditionAttrMap;
2160 delete pColorScaleTokenMap;
2161 delete pColorScaleEntryAttrTokenMap;
2162 delete pDataBarTokenMap;
2163 delete pDataBarAttrMap;
2164 delete pFormattingEntryAttrMap;
2165 delete pLabelRangesElemTokenMap;
2166 delete pLabelRangeAttrTokenMap;
2167 delete pTableElemTokenMap;
2168 delete pTableProtectionElemTokenMap;
2169 delete pTableRowsElemTokenMap;
2170 delete pTableColsElemTokenMap;
2171 delete pTableAttrTokenMap;
2172 delete pTableScenarioAttrTokenMap;
2173 delete pTableColAttrTokenMap;
2174 delete pTableRowElemTokenMap;
2175 delete pTableRowAttrTokenMap;
2176 delete pTableRowCellElemTokenMap;
2177 delete pTableRowCellAttrTokenMap;
2178 delete pTableAnnotationAttrTokenMap;
2179 delete pDetectiveElemTokenMap;
2180 delete pDetectiveHighlightedAttrTokenMap;
2181 delete pDetectiveOperationAttrTokenMap;
2182 delete pTableCellRangeSourceAttrTokenMap;
2183 delete pNamedExpressionsElemTokenMap;
2184 delete pNamedRangeAttrTokenMap;
2185 delete pNamedExpressionAttrTokenMap;
2186 delete pDatabaseRangesElemTokenMap;
2187 delete pDatabaseRangeElemTokenMap;
2188 delete pDatabaseRangeAttrTokenMap;
2189 delete pDatabaseRangeSourceSQLAttrTokenMap;
2190 delete pDatabaseRangeSourceTableAttrTokenMap;
2191 delete pDatabaseRangeSourceQueryAttrTokenMap;
2192 delete pFilterElemTokenMap;
2193 delete pFilterAttrTokenMap;
2194 delete pFilterConditionElemTokenMap;
2195 delete pFilterConditionAttrTokenMap;
2196 delete pFilterSetItemAttrTokenMap;
2197 delete pSortElemTokenMap;
2198 delete pSortAttrTokenMap;
2199 delete pSortSortByAttrTokenMap;
2200 delete pDatabaseRangeSubTotalRulesElemTokenMap;
2201 delete pDatabaseRangeSubTotalRulesAttrTokenMap;
2202 delete pSubTotalRulesSortGroupsAttrTokenMap;
2203 delete pSubTotalRulesSubTotalRuleElemTokenMap;
2204 delete pSubTotalRulesSubTotalRuleAttrTokenMap;
2205 delete pSubTotalRuleSubTotalFieldAttrTokenMap;
2206 delete pDataPilotTablesElemTokenMap;
2207 delete pDataPilotTableAttrTokenMap;
2208 delete pDataPilotTableElemTokenMap;
2209 delete pDataPilotTableSourceServiceAttrTokenMap;
2210 delete pDataPilotTableSourceCellRangeAttrTokenMap;
2211 delete pDataPilotTableSourceCellRangeElemTokenMap;
2212 delete pDataPilotFieldAttrTokenMap;
2213 delete pDataPilotFieldElemTokenMap;
2214 delete pDataPilotLevelAttrTokenMap;
2215 delete pDataPilotLevelElemTokenMap;
2216 delete pDataPilotSubTotalsElemTokenMap;
2217 delete pDataPilotSubTotalAttrTokenMap;
2218 delete pDataPilotMembersElemTokenMap;
2219 delete pDataPilotMemberAttrTokenMap;
2220 delete pConsolidationAttrTokenMap;
2221 delete pCellTextParaElemTokenMap;
2222 delete pCellTextSpanElemTokenMap;
2223 delete pCellTextSpanAttrTokenMap;
2224 delete pCellTextURLAttrTokenMap;
2225 delete pCellTextSAttrTokenMap;
2226 delete pDataStreamAttrTokenMap;
2228 delete pChangeTrackingImportHelper;
2229 delete pNumberFormatAttributesExportHelper;
2230 delete pStyleNumberFormats;
2231 delete pStylesImportHelper;
2233 delete pSolarMutexGuard;
2235 delete pMyNamedExpressions;
2236 delete pMyLabelRanges;
2237 delete pValidations;
2238 delete pDetectiveOpArray;
2241 void ScXMLImport::initialize( const css::uno::Sequence<css::uno::Any>& aArguments )
2242 throw (css::uno::Exception, css::uno::RuntimeException, std::exception)
2244 SvXMLImport::initialize(aArguments);
2246 uno::Reference<beans::XPropertySet> xInfoSet = getImportInfo();
2247 if (!xInfoSet.is())
2248 return;
2250 uno::Reference<beans::XPropertySetInfo> xInfoSetInfo = xInfoSet->getPropertySetInfo();
2251 if (!xInfoSetInfo.is())
2252 return;
2254 if (xInfoSetInfo->hasPropertyByName(SC_UNO_ODS_LOCK_SOLAR_MUTEX))
2255 xInfoSet->getPropertyValue(SC_UNO_ODS_LOCK_SOLAR_MUTEX) >>= mbLockSolarMutex;
2257 if (xInfoSetInfo->hasPropertyByName(SC_UNO_ODS_IMPORT_STYLES))
2258 xInfoSet->getPropertyValue(SC_UNO_ODS_IMPORT_STYLES) >>= mbImportStyles;
2261 SvXMLImportContext *ScXMLImport::CreateFontDeclsContext(const sal_uInt16 nPrefix, const OUString& rLocalName,
2262 const uno::Reference<xml::sax::XAttributeList>& xAttrList)
2264 XMLFontStylesContext *pFSContext = new XMLFontStylesContext(
2265 *this, nPrefix, rLocalName, xAttrList, osl_getThreadTextEncoding());
2266 SetFontDecls(pFSContext);
2267 SvXMLImportContext* pContext = pFSContext;
2268 return pContext;
2271 SvXMLImportContext *ScXMLImport::CreateStylesContext(const OUString& rLocalName,
2272 const uno::Reference<xml::sax::XAttributeList>& xAttrList, bool bIsAutoStyle )
2274 SvXMLImportContext* pContext = new XMLTableStylesContext(
2275 *this, XML_NAMESPACE_OFFICE, rLocalName, xAttrList, bIsAutoStyle);
2277 if (bIsAutoStyle)
2278 SetAutoStyles(static_cast<SvXMLStylesContext*>(pContext));
2279 else
2280 SetStyles(static_cast<SvXMLStylesContext*>(pContext));
2282 return pContext;
2285 SvXMLImportContext *ScXMLImport::CreateBodyContext(const OUString& rLocalName,
2286 const uno::Reference<xml::sax::XAttributeList>& xAttrList)
2288 return new ScXMLBodyContext(*this, XML_NAMESPACE_OFFICE, rLocalName, xAttrList);
2291 SvXMLImportContext *ScXMLImport::CreateMetaContext(
2292 const OUString& rLocalName )
2294 SvXMLImportContext* pContext = NULL;
2296 if (getImportFlags() & SvXMLImportFlags::META)
2298 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
2299 GetModel(), uno::UNO_QUERY_THROW);
2300 uno::Reference<document::XDocumentProperties> const xDocProps(
2301 (IsStylesOnlyMode()) ? 0 : xDPS->getDocumentProperties());
2302 pContext = new SvXMLMetaDocumentContext(*this,
2303 XML_NAMESPACE_OFFICE, rLocalName,
2304 xDocProps);
2307 if( !pContext )
2308 pContext = new SvXMLImportContext( *this,
2309 XML_NAMESPACE_OFFICE, rLocalName );
2311 return pContext;
2314 SvXMLImportContext *ScXMLImport::CreateScriptContext(
2315 const OUString& rLocalName )
2317 SvXMLImportContext* pContext = NULL;
2319 if( !(IsStylesOnlyMode()) )
2321 pContext = new XMLScriptContext( *this,
2322 XML_NAMESPACE_OFFICE, rLocalName,
2323 GetModel() );
2326 if( !pContext )
2327 pContext = new SvXMLImportContext( *this, XML_NAMESPACE_OFFICE,
2328 rLocalName );
2330 return pContext;
2333 void ScXMLImport::SetStatistics(
2334 const uno::Sequence<beans::NamedValue> & i_rStats)
2336 static const char* s_stats[] =
2337 { "TableCount", "CellCount", "ObjectCount", 0 };
2339 SvXMLImport::SetStatistics(i_rStats);
2341 sal_uInt32 nCount(0);
2342 for (sal_Int32 i = 0; i < i_rStats.getLength(); ++i) {
2343 for (const char** pStat = s_stats; *pStat != 0; ++pStat) {
2344 if (i_rStats[i].Name.equalsAscii(*pStat)) {
2345 sal_Int32 val = 0;
2346 if (i_rStats[i].Value >>= val) {
2347 nCount += val;
2348 } else {
2349 OSL_FAIL("ScXMLImport::SetStatistics: invalid entry");
2355 if (nCount)
2357 GetProgressBarHelper()->SetReference(nCount);
2358 GetProgressBarHelper()->SetValue(0);
2362 ScDocumentImport& ScXMLImport::GetDoc()
2364 return *mpDocImport;
2367 sal_Int16 ScXMLImport::GetCellType(const OUString& rStrValue) const
2369 CellTypeMap::const_iterator itr = aCellTypeMap.find(rStrValue);
2370 if (itr != aCellTypeMap.end())
2371 return itr->second;
2373 return util::NumberFormat::UNDEFINED;
2376 XMLShapeImportHelper* ScXMLImport::CreateShapeImport()
2378 return new XMLTableShapeImportHelper(*this);
2381 bool ScXMLImport::GetValidation(const OUString& sName, ScMyImportValidation& aValidation)
2383 if (pValidations)
2385 bool bFound(false);
2386 ScMyImportValidations::iterator aItr(pValidations->begin());
2387 ScMyImportValidations::iterator aEndItr(pValidations->end());
2388 while(aItr != aEndItr && !bFound)
2390 if (aItr->sName == sName)
2392 // source position must be set as string,
2393 // so sBaseCellAddress no longer has to be converted here
2395 bFound = true;
2397 else
2398 ++aItr;
2400 if (bFound)
2401 aValidation = *aItr;
2402 return bFound;
2404 return false;
2407 void ScXMLImport::AddNamedExpression(SCTAB nTab, ScMyNamedExpression* pNamedExp)
2409 ::std::unique_ptr<ScMyNamedExpression> p(pNamedExp);
2410 SheetNamedExpMap::iterator itr = maSheetNamedExpressions.find(nTab);
2411 if (itr == maSheetNamedExpressions.end())
2413 // No chain exists for this sheet. Create one.
2414 ::std::unique_ptr<ScMyNamedExpressions> pNew(new ScMyNamedExpressions);
2415 ::std::pair<SheetNamedExpMap::iterator, bool> r = o3tl::ptr_container::insert(maSheetNamedExpressions, nTab, std::move(pNew));
2416 if (!r.second)
2417 // insertion failed.
2418 return;
2420 itr = r.first;
2422 ScMyNamedExpressions& r = *itr->second;
2423 o3tl::ptr_container::push_back(r, std::move(p));
2426 ScXMLChangeTrackingImportHelper* ScXMLImport::GetChangeTrackingImportHelper()
2428 if (!pChangeTrackingImportHelper)
2429 pChangeTrackingImportHelper = new ScXMLChangeTrackingImportHelper();
2430 return pChangeTrackingImportHelper;
2433 void ScXMLImport::InsertStyles()
2435 GetStyles()->CopyStylesToDoc(true);
2437 // if content is going to be loaded with the same import, set bLatinDefaultStyle flag now
2438 if ( getImportFlags() & SvXMLImportFlags::CONTENT )
2439 ExamineDefaultStyle();
2442 void ScXMLImport::ExamineDefaultStyle()
2444 if (pDoc)
2446 // #i62435# after inserting the styles, check if the default style has a latin-script-only
2447 // number format (then, value cells can be pre-initialized with western script type)
2449 const ScPatternAttr* pDefPattern = pDoc->GetDefPattern();
2450 if (pDefPattern && sc::NumFmtUtil::isLatinScript(*pDefPattern, *pDoc))
2451 mpDocImport->setDefaultNumericScript(SvtScriptType::LATIN);
2455 void ScXMLImport::SetChangeTrackingViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rChangeProps)
2457 if (pDoc)
2459 sal_Int32 nCount(rChangeProps.getLength());
2460 if (nCount)
2462 ScXMLImport::MutexGuard aGuard(*this);
2463 sal_Int16 nTemp16(0);
2464 boost::scoped_ptr<ScChangeViewSettings> pViewSettings(new ScChangeViewSettings());
2465 for (sal_Int32 i = 0; i < nCount; ++i)
2467 OUString sName(rChangeProps[i].Name);
2468 if (sName == "ShowChanges")
2469 pViewSettings->SetShowChanges(::cppu::any2bool(rChangeProps[i].Value));
2470 else if (sName == "ShowAcceptedChanges")
2471 pViewSettings->SetShowAccepted(::cppu::any2bool(rChangeProps[i].Value));
2472 else if (sName == "ShowRejectedChanges")
2473 pViewSettings->SetShowRejected(::cppu::any2bool(rChangeProps[i].Value));
2474 else if (sName == "ShowChangesByDatetime")
2475 pViewSettings->SetHasDate(::cppu::any2bool(rChangeProps[i].Value));
2476 else if (sName == "ShowChangesByDatetimeMode")
2478 if (rChangeProps[i].Value >>= nTemp16)
2479 pViewSettings->SetTheDateMode(static_cast<SvxRedlinDateMode>(nTemp16));
2481 else if (sName == "ShowChangesByDatetimeFirstDatetime")
2483 util::DateTime aDateTime;
2484 if (rChangeProps[i].Value >>= aDateTime)
2486 pViewSettings->SetTheFirstDateTime(::DateTime(aDateTime));
2489 else if (sName == "ShowChangesByDatetimeSecondDatetime")
2491 util::DateTime aDateTime;
2492 if (rChangeProps[i].Value >>= aDateTime)
2494 pViewSettings->SetTheLastDateTime(::DateTime(aDateTime));
2497 else if (sName == "ShowChangesByAuthor")
2498 pViewSettings->SetHasAuthor(::cppu::any2bool(rChangeProps[i].Value));
2499 else if (sName == "ShowChangesByAuthorName")
2501 OUString sOUName;
2502 if (rChangeProps[i].Value >>= sOUName)
2504 OUString sAuthorName(sOUName);
2505 pViewSettings->SetTheAuthorToShow(sAuthorName);
2508 else if (sName == "ShowChangesByComment")
2509 pViewSettings->SetHasComment(::cppu::any2bool(rChangeProps[i].Value));
2510 else if (sName == "ShowChangesByCommentText")
2512 OUString sOUComment;
2513 if (rChangeProps[i].Value >>= sOUComment)
2515 OUString sComment(sOUComment);
2516 pViewSettings->SetTheComment(sComment);
2519 else if (sName == "ShowChangesByRanges")
2520 pViewSettings->SetHasRange(::cppu::any2bool(rChangeProps[i].Value));
2521 else if (sName == "ShowChangesByRangesList")
2523 OUString sRanges;
2524 if ((rChangeProps[i].Value >>= sRanges) && !sRanges.isEmpty())
2526 ScRangeList aRangeList;
2527 ScRangeStringConverter::GetRangeListFromString(
2528 aRangeList, sRanges, GetDocument(), FormulaGrammar::CONV_OOO);
2529 pViewSettings->SetTheRangeList(aRangeList);
2533 pDoc->SetChangeViewSettings(*pViewSettings);
2538 void ScXMLImport::SetViewSettings(const uno::Sequence<beans::PropertyValue>& aViewProps)
2540 sal_Int32 nCount(aViewProps.getLength());
2541 sal_Int32 nHeight(0);
2542 sal_Int32 nLeft(0);
2543 sal_Int32 nTop(0);
2544 sal_Int32 nWidth(0);
2545 for (sal_Int32 i = 0; i < nCount; ++i)
2547 OUString sName(aViewProps[i].Name);
2548 if (sName == "VisibleAreaHeight")
2549 aViewProps[i].Value >>= nHeight;
2550 else if (sName == "VisibleAreaLeft")
2551 aViewProps[i].Value >>= nLeft;
2552 else if (sName == "VisibleAreaTop")
2553 aViewProps[i].Value >>= nTop;
2554 else if (sName == "VisibleAreaWidth")
2555 aViewProps[i].Value >>= nWidth;
2556 else if (sName == "TrackedChangesViewSettings")
2558 uno::Sequence<beans::PropertyValue> aChangeProps;
2559 if(aViewProps[i].Value >>= aChangeProps)
2560 SetChangeTrackingViewSettings(aChangeProps);
2563 if (nHeight && nWidth)
2565 if (GetModel().is())
2567 ScModelObj* pDocObj(ScModelObj::getImplementation( GetModel() ));
2568 if (pDocObj)
2570 SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject();
2571 if (pEmbeddedObj)
2573 Rectangle aRect;
2574 aRect.setX( nLeft );
2575 aRect.setY( nTop );
2576 aRect.setWidth( nWidth );
2577 aRect.setHeight( nHeight );
2578 pEmbeddedObj->SetVisArea(aRect);
2585 void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyValue>& aConfigProps)
2587 if (GetModel().is())
2589 uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
2590 if (xMultiServiceFactory.is())
2592 sal_Int32 nCount(aConfigProps.getLength());
2593 OUString sCTName("TrackedChangesProtectionKey");
2594 OUString sVBName("VBACompatibilityMode");
2595 OUString sSCName("ScriptConfiguration");
2596 css::uno::Sequence<css::beans::PropertyValue> aFilteredProps(
2597 aConfigProps.getLength());
2598 sal_Int32 nFilteredPropsLen = 0;
2599 for (sal_Int32 i = nCount - 1; i >= 0; --i)
2601 if (aConfigProps[i].Name == sCTName)
2603 OUString sKey;
2604 if (aConfigProps[i].Value >>= sKey)
2606 uno::Sequence<sal_Int8> aPass;
2607 ::sax::Converter::decodeBase64(aPass, sKey);
2608 if (aPass.getLength())
2610 if (pDoc->GetChangeTrack())
2611 pDoc->GetChangeTrack()->SetProtection(aPass);
2612 else
2614 std::set<OUString> aUsers;
2615 ScChangeTrack* pTrack = new ScChangeTrack(pDoc, aUsers);
2616 pTrack->SetProtection(aPass);
2617 pDoc->SetChangeTrack(pTrack);
2622 // store the following items for later use (after document is loaded)
2623 else if ((aConfigProps[i].Name == sVBName) || (aConfigProps[i].Name == sSCName))
2625 uno::Reference< beans::XPropertySet > xImportInfo = getImportInfo();
2626 if (xImportInfo.is())
2628 uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = xImportInfo->getPropertySetInfo();
2629 if (xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName(aConfigProps[i].Name))
2630 xImportInfo->setPropertyValue( aConfigProps[i].Name, aConfigProps[i].Value );
2633 if (aConfigProps[i].Name != "LinkUpdateMode")
2635 aFilteredProps[nFilteredPropsLen++] = aConfigProps[i];
2638 aFilteredProps.realloc(nFilteredPropsLen);
2639 uno::Reference <uno::XInterface> xInterface = xMultiServiceFactory->createInstance("com.sun.star.comp.SpreadsheetSettings");
2640 uno::Reference <beans::XPropertySet> xProperties(xInterface, uno::UNO_QUERY);
2641 if (xProperties.is())
2642 SvXMLUnitConverter::convertPropertySet(xProperties, aFilteredProps);
2647 sal_Int32 ScXMLImport::SetCurrencySymbol(const sal_Int32 nKey, const OUString& rCurrency)
2649 uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
2650 if (xNumberFormatsSupplier.is())
2652 uno::Reference <util::XNumberFormats> xLocalNumberFormats(xNumberFormatsSupplier->getNumberFormats());
2653 if (xLocalNumberFormats.is())
2655 OUString sFormatString;
2658 uno::Reference <beans::XPropertySet> xProperties(xLocalNumberFormats->getByKey(nKey));
2659 if (xProperties.is())
2661 lang::Locale aLocale;
2662 if (GetDocument() && (xProperties->getPropertyValue(sLocale) >>= aLocale))
2665 ScXMLImport::MutexGuard aGuard(*this);
2666 LocaleDataWrapper aLocaleData( comphelper::getProcessComponentContext(), LanguageTag( aLocale) );
2667 OUStringBuffer aBuffer(15);
2668 aBuffer.appendAscii("#");
2669 aBuffer.append( aLocaleData.getNumThousandSep() );
2670 aBuffer.appendAscii("##0");
2671 aBuffer.append( aLocaleData.getNumDecimalSep() );
2672 aBuffer.appendAscii("00 [$");
2673 aBuffer.append(rCurrency);
2674 aBuffer.appendAscii("]");
2675 sFormatString = aBuffer.makeStringAndClear();
2677 sal_Int32 nNewKey = xLocalNumberFormats->queryKey(sFormatString, aLocale, true);
2678 if (nNewKey == -1)
2679 nNewKey = xLocalNumberFormats->addNew(sFormatString, aLocale);
2680 return nNewKey;
2684 catch ( const util::MalformedNumberFormatException& rException )
2686 OUString sErrorMessage("Fehler im Formatstring ");
2687 sErrorMessage += sFormatString;
2688 sErrorMessage += " an Position ";
2689 sErrorMessage += OUString::number(rException.CheckPos);
2690 uno::Sequence<OUString> aSeq(1);
2691 aSeq[0] = sErrorMessage;
2692 uno::Reference<xml::sax::XLocator> xLocator;
2693 SetError(XMLERROR_API | XMLERROR_FLAG_ERROR, aSeq, rException.Message, xLocator);
2697 return nKey;
2700 bool ScXMLImport::IsCurrencySymbol(const sal_Int32 nNumberFormat, const OUString& sCurrentCurrency, const OUString& sBankSymbol)
2702 uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
2703 if (xNumberFormatsSupplier.is())
2705 uno::Reference <util::XNumberFormats> xLocalNumberFormats(xNumberFormatsSupplier->getNumberFormats());
2706 if (xLocalNumberFormats.is())
2710 uno::Reference <beans::XPropertySet> xNumberPropertySet(xLocalNumberFormats->getByKey(nNumberFormat));
2711 if (xNumberPropertySet.is())
2713 OUString sTemp;
2714 if ( xNumberPropertySet->getPropertyValue(OUString(SC_CURRENCYSYMBOL)) >>= sTemp)
2716 if (sCurrentCurrency.equals(sTemp))
2717 return true;
2718 // #i61657# This may be a legacy currency symbol that changed in the meantime.
2719 if (SvNumberFormatter::GetLegacyOnlyCurrencyEntry( sCurrentCurrency, sBankSymbol) != NULL)
2720 return true;
2721 // In the rare case that sCurrentCurrency is not the
2722 // currency symbol, but a matching ISO code
2723 // abbreviation instead that was obtained through
2724 // XMLNumberFormatAttributesExportHelper::GetCellType(),
2725 // check with the number format's symbol. This happens,
2726 // for example, in the es_BO locale, where a legacy
2727 // B$,BOB matched B$->BOP, which leads to
2728 // sCurrentCurrency being BOP, and the previous call
2729 // with BOP,BOB didn't find an entry, but B$,BOB will.
2730 return SvNumberFormatter::GetLegacyOnlyCurrencyEntry( sTemp, sBankSymbol) != NULL;
2734 catch ( uno::Exception& )
2736 OSL_FAIL("Numberformat not found");
2740 return false;
2743 void ScXMLImport::SetType(uno::Reference <beans::XPropertySet>& rProperties,
2744 sal_Int32& rNumberFormat,
2745 const sal_Int16 nCellType,
2746 const OUString& rCurrency)
2748 if (!mbImportStyles)
2749 return;
2751 if ((nCellType != util::NumberFormat::TEXT) && (nCellType != util::NumberFormat::UNDEFINED))
2753 if (rNumberFormat == -1)
2754 rProperties->getPropertyValue( sNumberFormat ) >>= rNumberFormat;
2755 OSL_ENSURE(rNumberFormat != -1, "no NumberFormat");
2756 bool bIsStandard;
2757 // sCurrentCurrency may be the ISO code abbreviation if the currency
2758 // symbol matches such, or if no match found the symbol itself!
2759 OUString sCurrentCurrency;
2760 sal_Int32 nCurrentCellType(
2761 GetNumberFormatAttributesExportHelper()->GetCellType(
2762 rNumberFormat, sCurrentCurrency, bIsStandard) & ~util::NumberFormat::DEFINED);
2763 if ((nCellType != nCurrentCellType) && !((nCellType == util::NumberFormat::NUMBER &&
2764 ((nCurrentCellType == util::NumberFormat::SCIENTIFIC) ||
2765 (nCurrentCellType == util::NumberFormat::FRACTION) ||
2766 (nCurrentCellType == util::NumberFormat::LOGICAL) ||
2767 (nCurrentCellType == 0))) || (nCurrentCellType == util::NumberFormat::TEXT)) && !((nCellType == util::NumberFormat::DATETIME) &&
2768 (nCurrentCellType == util::NumberFormat::DATE)))
2770 if (!xNumberFormats.is())
2772 uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
2773 if (xNumberFormatsSupplier.is())
2774 xNumberFormats.set(xNumberFormatsSupplier->getNumberFormats());
2776 if (xNumberFormats.is())
2780 uno::Reference < beans::XPropertySet> xNumberFormatProperties(xNumberFormats->getByKey(rNumberFormat));
2781 if (xNumberFormatProperties.is())
2783 if (nCellType != util::NumberFormat::CURRENCY)
2785 lang::Locale aLocale;
2786 if ( xNumberFormatProperties->getPropertyValue(sLocale) >>= aLocale )
2788 if (!xNumberFormatTypes.is())
2789 xNumberFormatTypes.set(uno::Reference <util::XNumberFormatTypes>(xNumberFormats, uno::UNO_QUERY));
2790 rProperties->setPropertyValue( sNumberFormat, uno::makeAny(xNumberFormatTypes->getStandardFormat(nCellType, aLocale)) );
2793 else if (!rCurrency.isEmpty() && !sCurrentCurrency.isEmpty())
2795 if (!sCurrentCurrency.equals(rCurrency))
2796 if (!IsCurrencySymbol(rNumberFormat, sCurrentCurrency, rCurrency))
2797 rProperties->setPropertyValue( sNumberFormat, uno::makeAny(SetCurrencySymbol(rNumberFormat, rCurrency)));
2801 catch ( uno::Exception& )
2803 OSL_FAIL("Numberformat not found");
2807 else
2809 if ((nCellType == util::NumberFormat::CURRENCY) && !rCurrency.isEmpty() && !sCurrentCurrency.isEmpty() &&
2810 !sCurrentCurrency.equals(rCurrency) && !IsCurrencySymbol(rNumberFormat, sCurrentCurrency, rCurrency))
2811 rProperties->setPropertyValue( sNumberFormat, uno::makeAny(SetCurrencySymbol(rNumberFormat, rCurrency)));
2816 void ScXMLImport::AddStyleRange(const table::CellRangeAddress& rCellRange)
2818 if (!mbImportStyles)
2819 return;
2821 if (!xSheetCellRanges.is() && GetModel().is())
2823 uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
2824 if (xMultiServiceFactory.is())
2825 xSheetCellRanges.set(uno::Reference <sheet::XSheetCellRangeContainer>(xMultiServiceFactory->createInstance("com.sun.star.sheet.SheetCellRanges"), uno::UNO_QUERY));
2826 OSL_ENSURE(xSheetCellRanges.is(), "didn't get SheetCellRanges");
2829 xSheetCellRanges->addRangeAddress(rCellRange, false);
2832 void ScXMLImport::SetStyleToRanges()
2834 if (!mbImportStyles)
2835 return;
2837 if (!sPrevStyleName.isEmpty())
2839 uno::Reference <beans::XPropertySet> xProperties (xSheetCellRanges, uno::UNO_QUERY);
2840 if (xProperties.is())
2842 XMLTableStylesContext *pStyles(static_cast<XMLTableStylesContext *>(GetAutoStyles()));
2843 XMLTableStyleContext* pStyle = NULL;
2844 if ( pStyles )
2845 pStyle = const_cast<XMLTableStyleContext*>(static_cast<const XMLTableStyleContext *>(pStyles->FindStyleChildContext(
2846 XML_STYLE_FAMILY_TABLE_CELL, sPrevStyleName, true)));
2847 if (pStyle)
2849 pStyle->FillPropertySet(xProperties);
2850 // here needs to be the cond format import method
2851 sal_Int32 nNumberFormat(pStyle->GetNumberFormat());
2852 SetType(xProperties, nNumberFormat, nPrevCellType, sPrevCurrency);
2854 // store first cell of first range for each style, once per sheet
2855 uno::Sequence<table::CellRangeAddress> aAddresses(xSheetCellRanges->getRangeAddresses());
2856 pStyle->ApplyCondFormat(aAddresses);
2857 if ( aAddresses.getLength() > 0 )
2859 const table::CellRangeAddress& rRange = aAddresses[0];
2860 if ( rRange.Sheet != pStyle->GetLastSheet() )
2862 ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
2863 pSheetData->AddCellStyle( sPrevStyleName,
2864 ScAddress( (SCCOL)rRange.StartColumn, (SCROW)rRange.StartRow, (SCTAB)rRange.Sheet ) );
2865 pStyle->SetLastSheet(rRange.Sheet);
2869 else
2871 xProperties->setPropertyValue(sCellStyle, uno::makeAny(GetStyleDisplayName( XML_STYLE_FAMILY_TABLE_CELL, sPrevStyleName )));
2872 sal_Int32 nNumberFormat(GetStyleNumberFormats()->GetStyleNumberFormat(sPrevStyleName));
2873 bool bInsert(nNumberFormat == -1);
2874 SetType(xProperties, nNumberFormat, nPrevCellType, sPrevCurrency);
2875 if (bInsert)
2876 GetStyleNumberFormats()->AddStyleNumberFormat(sPrevStyleName, nNumberFormat);
2880 if (GetModel().is())
2882 uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
2883 if (xMultiServiceFactory.is())
2884 xSheetCellRanges.set(uno::Reference <sheet::XSheetCellRangeContainer>(
2885 xMultiServiceFactory->createInstance(
2886 OUString("com.sun.star.sheet.SheetCellRanges")),
2887 uno::UNO_QUERY));
2889 OSL_ENSURE(xSheetCellRanges.is(), "didn't get SheetCellRanges");
2892 void ScXMLImport::SetStyleToRange(const ScRange& rRange, const OUString* pStyleName,
2893 const sal_Int16 nCellType, const OUString* pCurrency)
2895 if (!mbImportStyles)
2896 return;
2898 if (sPrevStyleName.isEmpty())
2900 nPrevCellType = nCellType;
2901 if (pStyleName)
2902 sPrevStyleName = *pStyleName;
2903 if (pCurrency)
2904 sPrevCurrency = *pCurrency;
2905 else if (!sPrevCurrency.isEmpty())
2906 sPrevCurrency = sEmpty;
2908 else if ((nCellType != nPrevCellType) ||
2909 ((pStyleName && !pStyleName->equals(sPrevStyleName)) ||
2910 (!pStyleName && !sPrevStyleName.isEmpty())) ||
2911 ((pCurrency && !pCurrency->equals(sPrevCurrency)) ||
2912 (!pCurrency && !sPrevCurrency.isEmpty())))
2914 SetStyleToRanges();
2915 nPrevCellType = nCellType;
2916 if (pStyleName)
2917 sPrevStyleName = *pStyleName;
2918 else if(!sPrevStyleName.isEmpty())
2919 sPrevStyleName = sEmpty;
2920 if (pCurrency)
2921 sPrevCurrency = *pCurrency;
2922 else if(!sPrevCurrency.isEmpty())
2923 sPrevCurrency = sEmpty;
2925 table::CellRangeAddress aCellRange;
2926 aCellRange.StartColumn = rRange.aStart.Col();
2927 aCellRange.StartRow = rRange.aStart.Row();
2928 aCellRange.Sheet = rRange.aStart.Tab();
2929 aCellRange.EndColumn = rRange.aEnd.Col();
2930 aCellRange.EndRow = rRange.aEnd.Row();
2931 AddStyleRange(aCellRange);
2934 bool ScXMLImport::SetNullDateOnUnitConverter()
2936 if (!bNullDateSetted)
2937 bNullDateSetted = GetMM100UnitConverter().setNullDate(GetModel());
2938 OSL_ENSURE(bNullDateSetted, "could not set the null date");
2939 return bNullDateSetted;
2942 XMLNumberFormatAttributesExportHelper* ScXMLImport::GetNumberFormatAttributesExportHelper()
2944 if (!pNumberFormatAttributesExportHelper)
2945 pNumberFormatAttributesExportHelper = new XMLNumberFormatAttributesExportHelper(GetNumberFormatsSupplier());
2946 return pNumberFormatAttributesExportHelper;
2949 ScMyStyleNumberFormats* ScXMLImport::GetStyleNumberFormats()
2951 if (!pStyleNumberFormats)
2952 pStyleNumberFormats = new ScMyStyleNumberFormats();
2953 return pStyleNumberFormats;
2956 void ScXMLImport::SetStylesToRangesFinished()
2958 SetStyleToRanges();
2959 sPrevStyleName = sEmpty;
2962 // XImporter
2963 void SAL_CALL ScXMLImport::setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
2964 throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception)
2966 ScXMLImport::MutexGuard aGuard(*this);
2967 SvXMLImport::setTargetDocument( xDoc );
2969 uno::Reference<frame::XModel> xModel(xDoc, uno::UNO_QUERY);
2970 pDoc = ScXMLConverter::GetScDocument( xModel );
2971 OSL_ENSURE( pDoc, "ScXMLImport::setTargetDocument - no ScDocument!" );
2972 if (!pDoc)
2973 throw lang::IllegalArgumentException();
2975 mpDocImport.reset(new ScDocumentImport(*pDoc));
2976 mpComp.reset(new ScCompiler(pDoc, ScAddress()));
2977 mpComp->SetGrammar(formula::FormulaGrammar::GRAM_ODFF);
2979 uno::Reference<document::XActionLockable> xActionLockable(xDoc, uno::UNO_QUERY);
2980 if (xActionLockable.is())
2981 xActionLockable->addActionLock();
2984 // ::com::sun::star::xml::sax::XDocumentHandler
2985 void SAL_CALL ScXMLImport::startDocument()
2986 throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException, std::exception )
2988 ScXMLImport::MutexGuard aGuard(*this);
2989 SvXMLImport::startDocument();
2990 if (pDoc && !pDoc->IsImportingXML())
2992 ScModelObj::getImplementation(GetModel())->BeforeXMLLoading();
2993 bSelfImportingXMLSet = true;
2996 // if content and styles are loaded with separate imports,
2997 // set bLatinDefaultStyle flag at the start of the content import
2998 SvXMLImportFlags nFlags = getImportFlags();
2999 if ( ( nFlags & SvXMLImportFlags::CONTENT ) && !( nFlags & SvXMLImportFlags::STYLES ) )
3000 ExamineDefaultStyle();
3002 if (getImportFlags() & SvXMLImportFlags::CONTENT)
3004 if (GetModel().is())
3006 // store initial namespaces, to find the ones that were added from the file later
3007 ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
3008 const SvXMLNamespaceMap& rNamespaces = GetNamespaceMap();
3009 pSheetData->StoreInitialNamespaces(rNamespaces);
3013 uno::Reference< beans::XPropertySet > const xImportInfo( getImportInfo() );
3014 uno::Reference< beans::XPropertySetInfo > const xPropertySetInfo(
3015 xImportInfo.is() ? xImportInfo->getPropertySetInfo() : 0);
3016 if (xPropertySetInfo.is())
3018 OUString const sOrganizerMode(
3019 "OrganizerMode");
3020 if (xPropertySetInfo->hasPropertyByName(sOrganizerMode))
3022 bool bStyleOnly(false);
3023 if (xImportInfo->getPropertyValue(sOrganizerMode) >>= bStyleOnly)
3025 bLoadDoc = !bStyleOnly;
3030 UnlockSolarMutex();
3033 sal_Int32 ScXMLImport::GetRangeType(const OUString& sRangeType)
3035 sal_Int32 nRangeType(0);
3036 OUStringBuffer sBuffer;
3037 sal_Int16 i = 0;
3038 while (i <= sRangeType.getLength())
3040 if ((i == sRangeType.getLength()) || (sRangeType[i] == ' '))
3042 OUString sTemp = sBuffer.makeStringAndClear();
3043 if (sTemp == "repeat-column")
3044 nRangeType |= sheet::NamedRangeFlag::COLUMN_HEADER;
3045 else if (sTemp == SC_REPEAT_ROW)
3046 nRangeType |= sheet::NamedRangeFlag::ROW_HEADER;
3047 else if (sTemp == SC_FILTER)
3048 nRangeType |= sheet::NamedRangeFlag::FILTER_CRITERIA;
3049 else if (sTemp == SC_PRINT_RANGE)
3050 nRangeType |= sheet::NamedRangeFlag::PRINT_AREA;
3052 else if (i < sRangeType.getLength())
3053 sBuffer.append(sRangeType[i]);
3054 ++i;
3056 return nRangeType;
3059 void ScXMLImport::SetLabelRanges()
3061 ScMyLabelRanges* pLabelRanges = GetLabelRanges();
3062 if (pLabelRanges)
3064 uno::Reference <beans::XPropertySet> xPropertySet (GetModel(), uno::UNO_QUERY);
3065 if (xPropertySet.is())
3067 uno::Any aColAny = xPropertySet->getPropertyValue(OUString(SC_UNO_COLLABELRNG));
3068 uno::Any aRowAny = xPropertySet->getPropertyValue(OUString(SC_UNO_ROWLABELRNG));
3070 uno::Reference< sheet::XLabelRanges > xColRanges;
3071 uno::Reference< sheet::XLabelRanges > xRowRanges;
3073 if ( ( aColAny >>= xColRanges ) && ( aRowAny >>= xRowRanges ) )
3075 table::CellRangeAddress aLabelRange;
3076 table::CellRangeAddress aDataRange;
3078 ScMyLabelRanges::iterator aItr = pLabelRanges->begin();
3079 while (aItr != pLabelRanges->end())
3081 sal_Int32 nOffset1(0);
3082 sal_Int32 nOffset2(0);
3083 FormulaGrammar::AddressConvention eConv = FormulaGrammar::CONV_OOO;
3085 if (ScRangeStringConverter::GetRangeFromString( aLabelRange, (*aItr)->sLabelRangeStr, GetDocument(), eConv, nOffset1 ) &&
3086 ScRangeStringConverter::GetRangeFromString( aDataRange, (*aItr)->sDataRangeStr, GetDocument(), eConv, nOffset2 ))
3088 if ( (*aItr)->bColumnOrientation )
3089 xColRanges->addNew( aLabelRange, aDataRange );
3090 else
3091 xRowRanges->addNew( aLabelRange, aDataRange );
3094 delete *aItr;
3095 aItr = pLabelRanges->erase(aItr);
3102 namespace {
3104 class RangeNameInserter : public ::std::unary_function<ScMyNamedExpression, void>
3106 ScDocument* mpDoc;
3107 ScRangeName& mrRangeName;
3108 ScXMLImport& mrXmlImport;
3110 public:
3111 RangeNameInserter(ScDocument* pDoc, ScRangeName& rRangeName, ScXMLImport& rXmlImport) :
3112 mpDoc(pDoc), mrRangeName(rRangeName), mrXmlImport(rXmlImport) {}
3114 void operator() (const ScMyNamedExpression& r) const
3116 using namespace formula;
3118 const OUString& aType = r.sRangeType;
3119 sal_uInt32 nUnoType = ScXMLImport::GetRangeType(aType);
3121 sal_uInt16 nNewType = RT_NAME;
3122 if ( nUnoType & sheet::NamedRangeFlag::FILTER_CRITERIA ) nNewType |= RT_CRITERIA;
3123 if ( nUnoType & sheet::NamedRangeFlag::PRINT_AREA ) nNewType |= RT_PRINTAREA;
3124 if ( nUnoType & sheet::NamedRangeFlag::COLUMN_HEADER ) nNewType |= RT_COLHEADER;
3125 if ( nUnoType & sheet::NamedRangeFlag::ROW_HEADER ) nNewType |= RT_ROWHEADER;
3127 if (mpDoc)
3129 // Insert a new name.
3130 ScAddress aPos;
3131 sal_Int32 nOffset = 0;
3132 bool bSuccess = ScRangeStringConverter::GetAddressFromString(
3133 aPos, r.sBaseCellAddress, mpDoc, FormulaGrammar::CONV_OOO, nOffset);
3135 if (bSuccess)
3137 OUString aContent = r.sContent;
3138 if (!r.bIsExpression)
3139 ScXMLConverter::ParseFormula(aContent, false);
3141 ScRangeData* pData = new ScRangeData(
3142 mpDoc, r.sName, aContent, aPos, nNewType, r.eGrammar);
3143 mrRangeName.insert(pData);
3151 void ScXMLImport::SetNamedRanges()
3153 ScMyNamedExpressions* pNamedExpressions = GetNamedExpressions();
3154 if (!pNamedExpressions)
3155 return;
3157 if (!pDoc)
3158 return;
3160 // Insert the namedRanges
3161 ScRangeName* pRangeNames = pDoc->GetRangeName();
3162 ::std::for_each(pNamedExpressions->begin(), pNamedExpressions->end(), RangeNameInserter(pDoc, *pRangeNames, *this));
3165 void ScXMLImport::SetSheetNamedRanges()
3167 if (!pDoc)
3168 return;
3170 SheetNamedExpMap::const_iterator itr = maSheetNamedExpressions.begin(), itrEnd = maSheetNamedExpressions.end();
3171 for (; itr != itrEnd; ++itr)
3173 SCTAB nTab = itr->first;
3174 ScRangeName* pRangeNames = pDoc->GetRangeName(nTab);
3175 if (!pRangeNames)
3176 continue;
3178 const ScMyNamedExpressions& rNames = *itr->second;
3179 ::std::for_each(rNames.begin(), rNames.end(), RangeNameInserter(pDoc, *pRangeNames, *this));
3183 void ScXMLImport::SetStringRefSyntaxIfMissing()
3185 if (!pDoc)
3186 return;
3188 ScCalcConfig aCalcConfig = pDoc->GetCalcConfig();
3190 // Has any string ref syntax been imported?
3191 // If not, we need to take action
3192 if ( !aCalcConfig.mbHasStringRefSyntax )
3194 aCalcConfig.meStringRefAddressSyntax = formula::FormulaGrammar::CONV_A1_XL_A1;
3195 pDoc->SetCalcConfig(aCalcConfig);
3199 void SAL_CALL ScXMLImport::endDocument()
3200 throw(::com::sun::star::xml::sax::SAXException,
3201 ::com::sun::star::uno::RuntimeException,
3202 std::exception)
3204 ScXMLImport::MutexGuard aGuard(*this);
3205 if (getImportFlags() & SvXMLImportFlags::CONTENT)
3207 if (GetModel().is())
3209 mpDocImport->finalize();
3211 uno::Reference<document::XViewDataSupplier> xViewDataSupplier(GetModel(), uno::UNO_QUERY);
3212 if (xViewDataSupplier.is())
3214 uno::Reference<container::XIndexAccess> xIndexAccess(xViewDataSupplier->getViewData());
3215 if (xIndexAccess.is() && xIndexAccess->getCount() > 0)
3217 uno::Sequence< beans::PropertyValue > aSeq;
3218 if (xIndexAccess->getByIndex(0) >>= aSeq)
3220 sal_Int32 nCount (aSeq.getLength());
3221 for (sal_Int32 i = 0; i < nCount; ++i)
3223 OUString sName(aSeq[i].Name);
3224 if (sName == SC_ACTIVETABLE)
3226 OUString sValue;
3227 if(aSeq[i].Value >>= sValue)
3229 OUString sTabName(sValue);
3230 SCTAB nTab(0);
3231 if (pDoc->GetTable(sTabName, nTab))
3233 pDoc->SetVisibleTab(nTab);
3234 i = nCount;
3242 SetLabelRanges();
3243 SetNamedRanges();
3244 SetSheetNamedRanges();
3245 SetStringRefSyntaxIfMissing();
3246 if (mpPivotSources)
3247 // Process pivot table sources after the named ranges have been set.
3248 mpPivotSources->process();
3250 GetProgressBarHelper()->End(); // make room for subsequent SfxProgressBars
3251 if (pDoc)
3253 pDoc->CompileXML();
3255 // After CompileXML, links must be completely changed to the new URLs.
3256 // Otherwise, hasExternalFile for API wouldn't work (#i116940#),
3257 // and typing a new formula would create a second link with the same "real" file name.
3258 if (pDoc->HasExternalRefManager())
3259 pDoc->GetExternalRefManager()->updateAbsAfterLoad();
3262 // If the stream contains cells outside of the current limits, the styles can't be re-created,
3263 // so stream copying is disabled then.
3264 if (pDoc && GetModel().is() && !pDoc->HasRangeOverflow())
3266 // set "valid stream" flags after loading (before UpdateRowHeights, so changed formula results
3267 // in UpdateRowHeights can already clear the flags again)
3268 ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
3270 SCTAB nTabCount = pDoc->GetTableCount();
3271 for (SCTAB nTab=0; nTab<nTabCount; ++nTab)
3273 pDoc->SetDrawPageSize(nTab);
3274 if (!pSheetData->IsSheetBlocked( nTab ))
3275 pDoc->SetStreamValid( nTab, true );
3278 aTables.FixupOLEs();
3280 if (GetModel().is())
3282 uno::Reference<document::XActionLockable> xActionLockable(GetModel(), uno::UNO_QUERY);
3283 if (xActionLockable.is())
3284 xActionLockable->removeActionLock();
3286 SvXMLImport::endDocument();
3288 if(pDoc && bSelfImportingXMLSet)
3289 ScModelObj::getImplementation(GetModel())->AfterXMLLoading(true);
3292 // XEventListener
3293 void ScXMLImport::DisposingModel()
3295 SvXMLImport::DisposingModel();
3296 pDoc = NULL;
3299 ScXMLImport::MutexGuard::MutexGuard(ScXMLImport& rImport) :
3300 mrImport(rImport)
3302 mrImport.LockSolarMutex();
3305 ScXMLImport::MutexGuard::~MutexGuard()
3307 mrImport.UnlockSolarMutex();
3310 void ScXMLImport::LockSolarMutex()
3312 // #i62677# When called from DocShell/Wrapper, the SolarMutex is already locked,
3313 // so there's no need to allocate (and later delete) the SolarMutexGuard.
3314 if (!mbLockSolarMutex)
3316 DBG_TESTSOLARMUTEX();
3317 return;
3320 if (nSolarMutexLocked == 0)
3322 OSL_ENSURE(!pSolarMutexGuard, "Solar Mutex is locked");
3323 pSolarMutexGuard = new SolarMutexGuard();
3325 ++nSolarMutexLocked;
3328 void ScXMLImport::UnlockSolarMutex()
3330 if (nSolarMutexLocked > 0)
3332 nSolarMutexLocked--;
3333 if (nSolarMutexLocked == 0)
3335 OSL_ENSURE(pSolarMutexGuard, "Solar Mutex is always unlocked");
3336 delete pSolarMutexGuard;
3337 pSolarMutexGuard = NULL;
3342 sal_Int32 ScXMLImport::GetByteOffset()
3344 sal_Int32 nOffset = -1;
3345 uno::Reference<xml::sax::XLocator> xLocator = GetLocator();
3346 uno::Reference<io::XSeekable> xSeek( xLocator, uno::UNO_QUERY ); //! should use different interface
3347 if ( xSeek.is() )
3348 nOffset = (sal_Int32)xSeek->getPosition();
3349 return nOffset;
3352 void ScXMLImport::SetRangeOverflowType(sal_uInt32 nType)
3354 // #i31130# Overflow is stored in the document, because the ScXMLImport object
3355 // isn't available in ScXMLImportWrapper::ImportFromComponent when using the
3356 // OOo->Oasis transformation.
3358 if ( pDoc )
3359 pDoc->SetRangeOverflowType( nType );
3362 void ScXMLImport::ProgressBarIncrement(bool bEditCell, sal_Int32 nInc)
3364 nProgressCount += nInc;
3365 if (bEditCell || nProgressCount > 100)
3367 GetProgressBarHelper()->Increment(nProgressCount);
3368 nProgressCount = 0;
3372 void ScXMLImport::ExtractFormulaNamespaceGrammar(
3373 OUString& rFormula, OUString& rFormulaNmsp, FormulaGrammar::Grammar& reGrammar,
3374 const OUString& rAttrValue, bool bRestrictToExternalNmsp ) const
3376 // parse the attribute value, extract namespace ID, literal namespace, and formula string
3377 rFormulaNmsp.clear();
3378 sal_uInt16 nNsId = GetNamespaceMap()._GetKeyByAttrName( rAttrValue, 0, &rFormula, &rFormulaNmsp, false );
3380 // check if we have an ODF formula namespace
3381 if( !bRestrictToExternalNmsp ) switch( nNsId )
3383 case XML_NAMESPACE_OOOC:
3384 rFormulaNmsp.clear(); // remove namespace string for built-in grammar
3385 reGrammar = FormulaGrammar::GRAM_PODF;
3386 return;
3387 case XML_NAMESPACE_OF:
3388 rFormulaNmsp.clear(); // remove namespace string for built-in grammar
3389 reGrammar = FormulaGrammar::GRAM_ODFF;
3390 return;
3393 /* Find default grammar for formulas without namespace. There may be
3394 documents in the wild that stored no namespace in ODF 1.0/1.1. Use
3395 GRAM_PODF then (old style ODF 1.0/1.1 formulas). The default for ODF
3396 1.2 and later without namespace is GRAM_ODFF (OpenFormula). */
3397 FormulaGrammar::Grammar eDefaultGrammar =
3398 (GetDocument()->GetStorageGrammar() == FormulaGrammar::GRAM_PODF) ?
3399 FormulaGrammar::GRAM_PODF : FormulaGrammar::GRAM_ODFF;
3401 /* Check if we have no namespace at all. The value XML_NAMESPACE_NONE
3402 indicates that there is no colon. If the first character of the
3403 attribute value is the equality sign, the value XML_NAMESPACE_UNKNOWN
3404 indicates that there is a colon somewhere in the formula string. */
3405 if( (nNsId == XML_NAMESPACE_NONE) || ((nNsId == XML_NAMESPACE_UNKNOWN) && (rAttrValue.toChar() == '=')) )
3407 rFormula = rAttrValue; // return entire string as formula
3408 reGrammar = eDefaultGrammar;
3409 return;
3412 /* Check if a namespace URL could be resolved from the attribute value.
3413 Use that namespace only, if the Calc document knows an associated
3414 external formula parser. This prevents that the range operator in
3415 conjunction with defined names is confused as namespaces prefix, e.g.
3416 in the expression 'table:A1' where 'table' is a named reference. */
3417 if( ((nNsId & XML_NAMESPACE_UNKNOWN_FLAG) != 0) && !rFormulaNmsp.isEmpty() &&
3418 GetDocument()->GetFormulaParserPool().hasFormulaParser( rFormulaNmsp ) )
3420 reGrammar = FormulaGrammar::GRAM_EXTERNAL;
3421 return;
3424 /* All attempts failed (e.g. no namespace and no leading equality sign, or
3425 an invalid namespace prefix), continue with the entire attribute value. */
3426 rFormula = rAttrValue;
3427 rFormulaNmsp.clear(); // remove any namespace string
3428 reGrammar = eDefaultGrammar;
3431 bool ScXMLImport::IsFormulaErrorConstant( const OUString& rStr ) const
3433 if (!mpComp)
3434 return false;
3436 return mpComp->GetErrorConstant(rStr) > 0;
3439 ScEditEngineDefaulter* ScXMLImport::GetEditEngine()
3441 if (!mpEditEngine)
3443 mpEditEngine.reset(new ScEditEngineDefaulter(pDoc->GetEnginePool()));
3444 mpEditEngine->SetRefMapMode(MAP_100TH_MM);
3445 mpEditEngine->SetEditTextObjectPool(pDoc->GetEditPool());
3446 mpEditEngine->SetUpdateMode(false);
3447 mpEditEngine->EnableUndo(false);
3448 mpEditEngine->SetControlWord(mpEditEngine->GetControlWord() & ~EEControlBits::ALLOWBIGOBJS);
3450 return mpEditEngine.get();
3453 const ScXMLEditAttributeMap& ScXMLImport::GetEditAttributeMap() const
3455 if (!mpEditAttrMap)
3456 mpEditAttrMap.reset(new ScXMLEditAttributeMap);
3457 return *mpEditAttrMap;
3460 void ScXMLImport::NotifyEmbeddedFontRead()
3462 if ( pDoc )
3463 pDoc->SetIsUsingEmbededFonts( true );
3466 ScMyImpDetectiveOpArray* ScXMLImport::GetDetectiveOpArray()
3468 if (!pDetectiveOpArray)
3469 pDetectiveOpArray = new ScMyImpDetectiveOpArray();
3470 return pDetectiveOpArray;
3473 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */