merge the formfield patch from ooo-build
[ooovba.git] / sc / source / filter / xml / xmlimprt.cxx
blob2246b10bb7c84d414a74e80f07c4b3627e488888
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xmlimprt.cxx,v $
10 * $Revision: 1.132.30.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sc.hxx"
34 // INCLUDE ---------------------------------------------------------------
36 #include <svtools/zforlist.hxx>
38 #include <xmloff/nmspmap.hxx>
39 #include <xmloff/xmlnmspe.hxx>
40 #include <xmloff/i18nmap.hxx>
41 #include <xmloff/xmltkmap.hxx>
42 #include <xmloff/xmlictxt.hxx>
43 #include <xmloff/xmlmetai.hxx>
44 #include <sfx2/objsh.hxx>
45 #include <xmloff/xmlnumfi.hxx>
46 #include <xmloff/xmlscripti.hxx>
47 #include <xmloff/XMLFontStylesContext.hxx>
48 #include <xmloff/DocumentSettingsContext.hxx>
49 #include <xmloff/xmluconv.hxx>
50 #include <xmloff/numehelp.hxx>
51 #include <xmloff/xmltoken.hxx>
52 #include <xmloff/xmlerror.hxx>
54 #include <svtools/zforlist.hxx>
55 #include <svtools/zformat.hxx>
56 #include <svtools/languageoptions.hxx>
58 #include "xmlimprt.hxx"
59 #include "document.hxx"
60 #include "docuno.hxx"
61 #include "nameuno.hxx"
62 #include "xmlbodyi.hxx"
63 #include "xmlstyli.hxx"
64 #include "unoguard.hxx"
65 #include "ViewSettingsSequenceDefines.hxx"
67 #include "patattr.hxx"
69 #include "XMLConverter.hxx"
70 #include "XMLTableShapeImportHelper.hxx"
71 #include "XMLChangeTrackingImportHelper.hxx"
72 #include "chgviset.hxx"
73 #include "XMLStylesImportHelper.hxx"
74 #include "sheetdata.hxx"
75 #include "unonames.hxx"
76 #include "rangeutl.hxx"
77 #include "postit.hxx"
78 #include "formulaparserpool.hxx"
79 #include <comphelper/extract.hxx>
81 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
82 #include <com/sun/star/frame/XModel.hpp>
83 #include <com/sun/star/sheet/XSheetCellRange.hpp>
84 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
85 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
86 #include <com/sun/star/util/XMergeable.hpp>
87 #include <com/sun/star/sheet/CellInsertMode.hpp>
88 #include <com/sun/star/sheet/XCellRangeMovement.hpp>
89 #include <com/sun/star/document/XActionLockable.hpp>
90 #include <com/sun/star/util/NumberFormat.hpp>
91 #include <com/sun/star/util/XNumberFormatTypes.hpp>
92 #include <tools/urlobj.hxx>
93 #include <com/sun/star/sheet/XNamedRanges.hpp>
94 #include <com/sun/star/sheet/NamedRangeFlag.hpp>
95 #include <com/sun/star/sheet/XNamedRange.hpp>
96 #include <com/sun/star/sheet/XLabelRanges.hpp>
97 #include <com/sun/star/io/XSeekable.hpp>
99 #define SC_LOCALE "Locale"
100 #define SC_STANDARDFORMAT "StandardFormat"
101 #define SC_CURRENCYSYMBOL "CurrencySymbol"
102 #define SC_NAMEDRANGES "NamedRanges"
103 #define SC_REPEAT_COLUMN "repeat-column"
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 ::rtl::OUString;
113 OUString SAL_CALL ScXMLImport_getImplementationName() throw()
115 return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Calc.XMLOasisImporter" ) );
118 uno::Sequence< rtl::OUString > SAL_CALL ScXMLImport_getSupportedServiceNames() throw()
120 const rtl::OUString aServiceName( ScXMLImport_getImplementationName() );
121 return uno::Sequence< rtl::OUString > ( &aServiceName, 1 );
124 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_createInstance(
125 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
127 // #110680#
128 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_ALL);
129 return (cppu::OWeakObject*)new ScXMLImport( rSMgr, IMPORT_ALL );
132 OUString SAL_CALL ScXMLImport_Meta_getImplementationName() throw()
134 return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Calc.XMLOasisMetaImporter" ) );
137 uno::Sequence< rtl::OUString > SAL_CALL ScXMLImport_Meta_getSupportedServiceNames() throw()
139 const rtl::OUString aServiceName( ScXMLImport_Meta_getImplementationName() );
140 return uno::Sequence< rtl::OUString > ( &aServiceName, 1 );
143 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Meta_createInstance(
144 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
146 // #110680#
147 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_META);
148 return (cppu::OWeakObject*)new ScXMLImport( rSMgr, IMPORT_META );
151 OUString SAL_CALL ScXMLImport_Styles_getImplementationName() throw()
153 return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Calc.XMLOasisStylesImporter" ) );
156 uno::Sequence< rtl::OUString > SAL_CALL ScXMLImport_Styles_getSupportedServiceNames() throw()
158 const rtl::OUString aServiceName( ScXMLImport_Styles_getImplementationName() );
159 return uno::Sequence< rtl::OUString > ( &aServiceName, 1 );
162 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Styles_createInstance(
163 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
165 // #110680#
166 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES|IMPORT_FONTDECLS);
167 return (cppu::OWeakObject*)new ScXMLImport( rSMgr, IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES|IMPORT_FONTDECLS);
170 OUString SAL_CALL ScXMLImport_Content_getImplementationName() throw()
172 return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Calc.XMLOasisContentImporter" ) );
175 uno::Sequence< rtl::OUString > SAL_CALL ScXMLImport_Content_getSupportedServiceNames() throw()
177 const rtl::OUString aServiceName( ScXMLImport_Content_getImplementationName() );
178 return uno::Sequence< rtl::OUString > ( &aServiceName, 1 );
181 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Content_createInstance(
182 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
184 // #110680#
185 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_META|IMPORT_STYLES|IMPORT_MASTERSTYLES|IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_SETTINGS|IMPORT_FONTDECLS);
186 return (cppu::OWeakObject*)new ScXMLImport( rSMgr, IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS);
189 OUString SAL_CALL ScXMLImport_Settings_getImplementationName() throw()
191 return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Calc.XMLOasisSettingsImporter" ) );
194 uno::Sequence< rtl::OUString > SAL_CALL ScXMLImport_Settings_getSupportedServiceNames() throw()
196 const rtl::OUString aServiceName( ScXMLImport_Settings_getImplementationName() );
197 return uno::Sequence< rtl::OUString > ( &aServiceName, 1 );
200 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Settings_createInstance(
201 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
203 // #110680#
204 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_SETTINGS);
205 return (cppu::OWeakObject*)new ScXMLImport( rSMgr, IMPORT_SETTINGS );
208 const SvXMLTokenMap& ScXMLImport::GetTableRowCellAttrTokenMap()
210 static __FAR_DATA SvXMLTokenMapEntry aTableRowCellAttrTokenMap[] =
212 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_ROW_CELL_ATTR_STYLE_NAME },
213 { XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION_NAME, XML_TOK_TABLE_ROW_CELL_ATTR_CONTENT_VALIDATION_NAME },
214 { XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_ROWS },
215 { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_COLS },
216 { XML_NAMESPACE_TABLE, XML_NUMBER_MATRIX_COLUMNS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_COLS },
217 { XML_NAMESPACE_TABLE, XML_NUMBER_MATRIX_ROWS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_ROWS },
218 { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, XML_TOK_TABLE_ROW_CELL_ATTR_REPEATED },
219 { XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE },
220 { XML_NAMESPACE_OFFICE, XML_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_VALUE },
221 { XML_NAMESPACE_OFFICE, XML_DATE_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_DATE_VALUE },
222 { XML_NAMESPACE_OFFICE, XML_TIME_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_TIME_VALUE },
223 { XML_NAMESPACE_OFFICE, XML_STRING_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_STRING_VALUE },
224 { XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_BOOLEAN_VALUE },
225 { XML_NAMESPACE_TABLE, XML_FORMULA, XML_TOK_TABLE_ROW_CELL_ATTR_FORMULA },
226 { XML_NAMESPACE_OFFICE, XML_CURRENCY, XML_TOK_TABLE_ROW_CELL_ATTR_CURRENCY },
227 XML_TOKEN_MAP_END
230 if ( !pTableRowCellAttrTokenMap )
231 pTableRowCellAttrTokenMap = new SvXMLTokenMap( aTableRowCellAttrTokenMap );
232 return *pTableRowCellAttrTokenMap;
235 //----------------------------------------------------------------------------
257 // NB: virtually inherit so we can multiply inherit properly
258 // in ScXMLFlatDocContext_Impl
259 class ScXMLDocContext_Impl : public virtual SvXMLImportContext
261 protected:
262 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
263 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
265 public:
267 ScXMLDocContext_Impl( ScXMLImport& rImport,
268 USHORT nPrfx,
269 const OUString& rLName,
270 const uno::Reference<xml::sax::XAttributeList>& xAttrList );
271 virtual ~ScXMLDocContext_Impl();
273 virtual SvXMLImportContext *CreateChildContext( USHORT nPrefix,
274 const rtl::OUString& rLocalName,
275 const uno::Reference<xml::sax::XAttributeList>& xAttrList );
278 ScXMLDocContext_Impl::ScXMLDocContext_Impl( ScXMLImport& rImport, USHORT nPrfx,
279 const OUString& rLName,
280 const uno::Reference<xml::sax::XAttributeList>& /* xAttrList */ ) :
281 SvXMLImportContext( rImport, nPrfx, rLName )
286 ScXMLDocContext_Impl::~ScXMLDocContext_Impl()
290 // context for flat file xml format
291 class ScXMLFlatDocContext_Impl
292 : public ScXMLDocContext_Impl, public SvXMLMetaDocumentContext
294 public:
295 ScXMLFlatDocContext_Impl( ScXMLImport& i_rImport,
296 USHORT i_nPrefix, const OUString & i_rLName,
297 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
298 const uno::Reference<document::XDocumentProperties>& i_xDocProps,
299 const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder);
301 virtual ~ScXMLFlatDocContext_Impl();
303 virtual SvXMLImportContext *CreateChildContext(
304 USHORT i_nPrefix, const OUString& i_rLocalName,
305 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList);
308 ScXMLFlatDocContext_Impl::ScXMLFlatDocContext_Impl( ScXMLImport& i_rImport,
309 USHORT i_nPrefix, const OUString & i_rLName,
310 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
311 const uno::Reference<document::XDocumentProperties>& i_xDocProps,
312 const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder) :
313 SvXMLImportContext(i_rImport, i_nPrefix, i_rLName),
314 ScXMLDocContext_Impl(i_rImport, i_nPrefix, i_rLName, i_xAttrList),
315 SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName,
316 i_xDocProps, i_xDocBuilder)
320 ScXMLFlatDocContext_Impl::~ScXMLFlatDocContext_Impl() { }
323 SvXMLImportContext *ScXMLFlatDocContext_Impl::CreateChildContext(
324 USHORT i_nPrefix, const OUString& i_rLocalName,
325 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList)
327 // behave like meta base class iff we encounter office:meta
328 const SvXMLTokenMap& rTokenMap = GetScImport().GetDocElemTokenMap();
329 if ( XML_TOK_DOC_META == rTokenMap.Get( i_nPrefix, i_rLocalName ) ) {
330 return SvXMLMetaDocumentContext::CreateChildContext(
331 i_nPrefix, i_rLocalName, i_xAttrList );
332 } else {
333 return ScXMLDocContext_Impl::CreateChildContext(
334 i_nPrefix, i_rLocalName, i_xAttrList );
338 class ScXMLBodyContext_Impl : public SvXMLImportContext
340 const ScXMLImport& GetScImport() const
341 { return (const ScXMLImport&)GetImport(); }
342 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
344 public:
346 ScXMLBodyContext_Impl( ScXMLImport& rImport, sal_uInt16 nPrfx,
347 const OUString& rLName,
348 const uno::Reference< xml::sax::XAttributeList > & xAttrList );
349 virtual ~ScXMLBodyContext_Impl();
351 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
352 const OUString& rLocalName,
353 const uno::Reference< xml::sax::XAttributeList > & xAttrList );
356 ScXMLBodyContext_Impl::ScXMLBodyContext_Impl( ScXMLImport& rImport,
357 sal_uInt16 nPrfx, const OUString& rLName,
358 const uno::Reference< xml::sax::XAttributeList > & /* xAttrList */ ) :
359 SvXMLImportContext( rImport, nPrfx, rLName )
363 ScXMLBodyContext_Impl::~ScXMLBodyContext_Impl()
367 SvXMLImportContext *ScXMLBodyContext_Impl::CreateChildContext(
368 sal_uInt16 /* nPrefix */,
369 const OUString& rLocalName,
370 const uno::Reference< xml::sax::XAttributeList > & xAttrList )
372 return GetScImport().CreateBodyContext( rLocalName, xAttrList );
375 SvXMLImportContext *ScXMLDocContext_Impl::CreateChildContext( USHORT nPrefix,
376 const rtl::OUString& rLocalName,
377 const uno::Reference<xml::sax::XAttributeList>& xAttrList )
379 SvXMLImportContext *pContext(0);
381 const SvXMLTokenMap& rTokenMap(GetScImport().GetDocElemTokenMap());
382 switch( rTokenMap.Get( nPrefix, rLocalName ) )
384 case XML_TOK_DOC_FONTDECLS:
385 if (GetScImport().getImportFlags() & IMPORT_FONTDECLS)
386 pContext = GetScImport().CreateFontDeclsContext(nPrefix, rLocalName, xAttrList);
387 break;
388 case XML_TOK_DOC_STYLES:
389 if (GetScImport().getImportFlags() & IMPORT_STYLES)
390 pContext = GetScImport().CreateStylesContext( rLocalName, xAttrList, sal_False);
391 break;
392 case XML_TOK_DOC_AUTOSTYLES:
393 if (GetScImport().getImportFlags() & IMPORT_AUTOSTYLES)
394 pContext = GetScImport().CreateStylesContext( rLocalName, xAttrList, sal_True);
395 break;
396 case XML_TOK_DOC_MASTERSTYLES:
397 if (GetScImport().getImportFlags() & IMPORT_MASTERSTYLES)
398 pContext = new ScXMLMasterStylesContext( GetImport(), nPrefix, rLocalName,
399 xAttrList );
400 break;
401 case XML_TOK_DOC_META:
402 DBG_WARNING("XML_TOK_DOC_META: should not have come here, maybe document is invalid?");
403 break;
404 case XML_TOK_DOC_SCRIPTS:
405 if (GetScImport().getImportFlags() & IMPORT_SCRIPTS)
406 pContext = GetScImport().CreateScriptContext( rLocalName );
407 break;
408 case XML_TOK_DOC_BODY:
409 if (GetScImport().getImportFlags() & IMPORT_CONTENT)
410 pContext = new ScXMLBodyContext_Impl( GetScImport(), nPrefix,
411 rLocalName, xAttrList );
412 break;
413 case XML_TOK_DOC_SETTINGS:
414 if (GetScImport().getImportFlags() & IMPORT_SETTINGS)
415 pContext = new XMLDocumentSettingsContext(GetScImport(), nPrefix, rLocalName, xAttrList );
416 break;
419 if(!pContext)
420 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
422 return pContext;
425 const SvXMLTokenMap& ScXMLImport::GetDocElemTokenMap()
427 if( !pDocElemTokenMap )
429 static __FAR_DATA SvXMLTokenMapEntry aDocTokenMap[] =
431 { XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS, XML_TOK_DOC_FONTDECLS },
432 { XML_NAMESPACE_OFFICE, XML_STYLES, XML_TOK_DOC_STYLES },
433 { XML_NAMESPACE_OFFICE, XML_AUTOMATIC_STYLES, XML_TOK_DOC_AUTOSTYLES },
434 { XML_NAMESPACE_OFFICE, XML_MASTER_STYLES, XML_TOK_DOC_MASTERSTYLES },
435 { XML_NAMESPACE_OFFICE, XML_META, XML_TOK_DOC_META },
436 { XML_NAMESPACE_OFFICE, XML_SCRIPTS, XML_TOK_DOC_SCRIPTS },
437 { XML_NAMESPACE_OFFICE, XML_BODY, XML_TOK_DOC_BODY },
438 { XML_NAMESPACE_OFFICE, XML_SETTINGS, XML_TOK_DOC_SETTINGS },
439 XML_TOKEN_MAP_END
442 pDocElemTokenMap = new SvXMLTokenMap( aDocTokenMap );
444 } // if( !pDocElemTokenMap )
446 return *pDocElemTokenMap;
450 const SvXMLTokenMap& ScXMLImport::GetBodyElemTokenMap()
452 if( !pBodyElemTokenMap )
454 static __FAR_DATA SvXMLTokenMapEntry aBodyTokenMap[] =
456 { XML_NAMESPACE_TABLE, XML_TRACKED_CHANGES, XML_TOK_BODY_TRACKED_CHANGES },
457 { XML_NAMESPACE_TABLE, XML_CALCULATION_SETTINGS, XML_TOK_BODY_CALCULATION_SETTINGS },
458 { XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATIONS, XML_TOK_BODY_CONTENT_VALIDATIONS },
459 { XML_NAMESPACE_TABLE, XML_LABEL_RANGES, XML_TOK_BODY_LABEL_RANGES },
460 { XML_NAMESPACE_TABLE, XML_TABLE, XML_TOK_BODY_TABLE },
461 { XML_NAMESPACE_TABLE, XML_NAMED_EXPRESSIONS, XML_TOK_BODY_NAMED_EXPRESSIONS },
462 { XML_NAMESPACE_TABLE, XML_DATABASE_RANGES, XML_TOK_BODY_DATABASE_RANGES },
463 { XML_NAMESPACE_TABLE, XML_DATABASE_RANGE, XML_TOK_BODY_DATABASE_RANGE },
464 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_TABLES, XML_TOK_BODY_DATA_PILOT_TABLES },
465 { XML_NAMESPACE_TABLE, XML_CONSOLIDATION, XML_TOK_BODY_CONSOLIDATION },
466 { XML_NAMESPACE_TABLE, XML_DDE_LINKS, XML_TOK_BODY_DDE_LINKS },
467 XML_TOKEN_MAP_END
470 pBodyElemTokenMap = new SvXMLTokenMap( aBodyTokenMap );
471 } // if( !pBodyElemTokenMap )
473 return *pBodyElemTokenMap;
476 const SvXMLTokenMap& ScXMLImport::GetContentValidationsElemTokenMap()
478 if( !pContentValidationsElemTokenMap )
480 static __FAR_DATA SvXMLTokenMapEntry aContentValidationsElemTokenMap[] =
482 { XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION, XML_TOK_CONTENT_VALIDATION },
483 XML_TOKEN_MAP_END
486 pContentValidationsElemTokenMap = new SvXMLTokenMap( aContentValidationsElemTokenMap );
487 } // if( !pContentValidationsElemTokenMap )
489 return *pContentValidationsElemTokenMap;
492 const SvXMLTokenMap& ScXMLImport::GetContentValidationElemTokenMap()
494 if( !pContentValidationElemTokenMap )
496 static __FAR_DATA SvXMLTokenMapEntry aContentValidationElemTokenMap[] =
498 { XML_NAMESPACE_TABLE, XML_HELP_MESSAGE, XML_TOK_CONTENT_VALIDATION_ELEM_HELP_MESSAGE },
499 { XML_NAMESPACE_TABLE, XML_ERROR_MESSAGE, XML_TOK_CONTENT_VALIDATION_ELEM_ERROR_MESSAGE },
500 { XML_NAMESPACE_TABLE, XML_ERROR_MACRO, XML_TOK_CONTENT_VALIDATION_ELEM_ERROR_MACRO },
501 { XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, XML_TOK_CONTENT_VALIDATION_ELEM_EVENT_LISTENERS },
502 XML_TOKEN_MAP_END
505 pContentValidationElemTokenMap = new SvXMLTokenMap( aContentValidationElemTokenMap );
506 } // if( !pContentValidationElemTokenMap )
508 return *pContentValidationElemTokenMap;
511 const SvXMLTokenMap& ScXMLImport::GetContentValidationAttrTokenMap()
513 if( !pContentValidationAttrTokenMap )
515 static __FAR_DATA SvXMLTokenMapEntry aContentValidationAttrTokenMap[] =
517 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_CONTENT_VALIDATION_NAME },
518 { XML_NAMESPACE_TABLE, XML_CONDITION, XML_TOK_CONTENT_VALIDATION_CONDITION },
519 { XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, XML_TOK_CONTENT_VALIDATION_BASE_CELL_ADDRESS },
520 { XML_NAMESPACE_TABLE, XML_ALLOW_EMPTY_CELL, XML_TOK_CONTENT_VALIDATION_ALLOW_EMPTY_CELL },
521 { XML_NAMESPACE_TABLE, XML_DISPLAY_LIST, XML_TOK_CONTENT_VALIDATION_DISPLAY_LIST },
522 XML_TOKEN_MAP_END
525 pContentValidationAttrTokenMap = new SvXMLTokenMap( aContentValidationAttrTokenMap );
526 } // if( !pContentValidationAttrTokenMap )
528 return *pContentValidationAttrTokenMap;
531 const SvXMLTokenMap& ScXMLImport::GetContentValidationMessageElemTokenMap()
533 if( !pContentValidationMessageElemTokenMap )
535 static __FAR_DATA SvXMLTokenMapEntry aContentValidationMessageElemTokenMap[] =
537 { XML_NAMESPACE_TEXT, XML_P, XML_TOK_P },
538 XML_TOKEN_MAP_END
541 pContentValidationMessageElemTokenMap = new SvXMLTokenMap( aContentValidationMessageElemTokenMap );
542 } // if( !pContentValidationMessageElemTokenMap )
544 return *pContentValidationMessageElemTokenMap;
547 const SvXMLTokenMap& ScXMLImport::GetContentValidationHelpMessageAttrTokenMap()
549 if( !pContentValidationHelpMessageAttrTokenMap )
551 static __FAR_DATA SvXMLTokenMapEntry aContentValidationHelpMessageAttrTokenMap[] =
553 { XML_NAMESPACE_TABLE, XML_TITLE, XML_TOK_HELP_MESSAGE_ATTR_TITLE },
554 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_HELP_MESSAGE_ATTR_DISPLAY },
555 XML_TOKEN_MAP_END
558 pContentValidationHelpMessageAttrTokenMap = new SvXMLTokenMap( aContentValidationHelpMessageAttrTokenMap );
559 } // if( !pContentValidationHelpMessageAttrTokenMap )
561 return *pContentValidationHelpMessageAttrTokenMap;
564 const SvXMLTokenMap& ScXMLImport::GetContentValidationErrorMessageAttrTokenMap()
566 if( !pContentValidationErrorMessageAttrTokenMap )
568 static __FAR_DATA SvXMLTokenMapEntry aContentValidationErrorMessageAttrTokenMap[] =
570 { XML_NAMESPACE_TABLE, XML_TITLE, XML_TOK_ERROR_MESSAGE_ATTR_TITLE },
571 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_ERROR_MESSAGE_ATTR_DISPLAY },
572 { XML_NAMESPACE_TABLE, XML_MESSAGE_TYPE, XML_TOK_ERROR_MESSAGE_ATTR_MESSAGE_TYPE },
573 XML_TOKEN_MAP_END
576 pContentValidationErrorMessageAttrTokenMap = new SvXMLTokenMap( aContentValidationErrorMessageAttrTokenMap );
577 } // if( !pContentValidationErrorMessageAttrTokenMap )
579 return *pContentValidationErrorMessageAttrTokenMap;
582 const SvXMLTokenMap& ScXMLImport::GetContentValidationErrorMacroAttrTokenMap()
584 if( !pContentValidationErrorMacroAttrTokenMap )
586 static __FAR_DATA SvXMLTokenMapEntry aContentValidationErrorMacroAttrTokenMap[] =
588 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_ERROR_MACRO_ATTR_NAME },
589 { XML_NAMESPACE_TABLE, XML_EXECUTE, XML_TOK_ERROR_MACRO_ATTR_EXECUTE },
590 XML_TOKEN_MAP_END
593 pContentValidationErrorMacroAttrTokenMap = new SvXMLTokenMap( aContentValidationErrorMacroAttrTokenMap );
594 } // if( !pContentValidationErrorMacroAttrTokenMap )
596 return *pContentValidationErrorMacroAttrTokenMap;
599 const SvXMLTokenMap& ScXMLImport::GetLabelRangesElemTokenMap()
601 if( !pLabelRangesElemTokenMap )
603 static __FAR_DATA SvXMLTokenMapEntry aLabelRangesElemTokenMap[] =
605 { XML_NAMESPACE_TABLE, XML_LABEL_RANGE, XML_TOK_LABEL_RANGE_ELEM },
606 XML_TOKEN_MAP_END
609 pLabelRangesElemTokenMap = new SvXMLTokenMap( aLabelRangesElemTokenMap );
610 } // if( !pLabelRangesElemTokenMap )
612 return *pLabelRangesElemTokenMap;
615 const SvXMLTokenMap& ScXMLImport::GetLabelRangeAttrTokenMap()
617 if( !pLabelRangeAttrTokenMap )
619 static __FAR_DATA SvXMLTokenMapEntry aLabelRangeAttrTokenMap[] =
621 { XML_NAMESPACE_TABLE, XML_LABEL_CELL_RANGE_ADDRESS, XML_TOK_LABEL_RANGE_ATTR_LABEL_RANGE },
622 { XML_NAMESPACE_TABLE, XML_DATA_CELL_RANGE_ADDRESS, XML_TOK_LABEL_RANGE_ATTR_DATA_RANGE },
623 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_LABEL_RANGE_ATTR_ORIENTATION },
624 XML_TOKEN_MAP_END
627 pLabelRangeAttrTokenMap = new SvXMLTokenMap( aLabelRangeAttrTokenMap );
628 } // if( !pLabelRangeAttrTokenMap )
630 return *pLabelRangeAttrTokenMap;
633 const SvXMLTokenMap& ScXMLImport::GetTableElemTokenMap()
635 if( !pTableElemTokenMap )
637 static __FAR_DATA SvXMLTokenMapEntry aTableTokenMap[] =
639 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN_GROUP, XML_TOK_TABLE_COL_GROUP },
640 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_COLUMNS, XML_TOK_TABLE_HEADER_COLS },
641 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, XML_TOK_TABLE_COLS },
642 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, XML_TOK_TABLE_COL },
643 { XML_NAMESPACE_TABLE, XML_TABLE_PROTECTION, XML_TOK_TABLE_PROTECTION },
644 { XML_NAMESPACE_TABLE, XML_TABLE_ROW_GROUP, XML_TOK_TABLE_ROW_GROUP },
645 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_ROWS, XML_TOK_TABLE_HEADER_ROWS },
646 { XML_NAMESPACE_TABLE, XML_TABLE_ROWS, XML_TOK_TABLE_ROWS },
647 { XML_NAMESPACE_TABLE, XML_TABLE_ROW, XML_TOK_TABLE_ROW },
648 { XML_NAMESPACE_TABLE, XML_TABLE_SOURCE, XML_TOK_TABLE_SOURCE },
649 { XML_NAMESPACE_TABLE, XML_SCENARIO, XML_TOK_TABLE_SCENARIO },
650 { XML_NAMESPACE_TABLE, XML_SHAPES, XML_TOK_TABLE_SHAPES },
651 { XML_NAMESPACE_OFFICE, XML_FORMS, XML_TOK_TABLE_FORMS },
652 XML_TOKEN_MAP_END
655 pTableElemTokenMap = new SvXMLTokenMap( aTableTokenMap );
656 } // if( !pTableElemTokenMap )
658 return *pTableElemTokenMap;
661 const SvXMLTokenMap& ScXMLImport::GetTableProtectionAttrTokenMap()
663 if (!pTableProtectionElemTokenMap)
665 static __FAR_DATA SvXMLTokenMapEntry aTableProtectionTokenMap[] =
667 { XML_NAMESPACE_TABLE, XML_SELECT_PROTECTED_CELLS, XML_TOK_TABLE_SELECT_PROTECTED_CELLS },
668 { XML_NAMESPACE_TABLE, XML_SELECT_UNPROTECTED_CELLS, XML_TOK_TABLE_SELECT_UNPROTECTED_CELLS },
669 XML_TOKEN_MAP_END
671 pTableProtectionElemTokenMap = new SvXMLTokenMap(aTableProtectionTokenMap);
674 return *pTableProtectionElemTokenMap;
677 const SvXMLTokenMap& ScXMLImport::GetTableRowsElemTokenMap()
679 if( !pTableRowsElemTokenMap )
681 static __FAR_DATA SvXMLTokenMapEntry aTableRowsElemTokenMap[] =
683 { XML_NAMESPACE_TABLE, XML_TABLE_ROW_GROUP, XML_TOK_TABLE_ROWS_ROW_GROUP },
684 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_ROWS, XML_TOK_TABLE_ROWS_HEADER_ROWS },
685 { XML_NAMESPACE_TABLE, XML_TABLE_ROWS, XML_TOK_TABLE_ROWS_ROWS },
686 { XML_NAMESPACE_TABLE, XML_TABLE_ROW, XML_TOK_TABLE_ROWS_ROW },
687 XML_TOKEN_MAP_END
690 pTableRowsElemTokenMap = new SvXMLTokenMap( aTableRowsElemTokenMap );
691 } // if( !pTableRowsElemTokenMap )
693 return *pTableRowsElemTokenMap;
696 const SvXMLTokenMap& ScXMLImport::GetTableColsElemTokenMap()
698 if( !pTableColsElemTokenMap )
700 static __FAR_DATA SvXMLTokenMapEntry aTableColsElemTokenMap[] =
702 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN_GROUP, XML_TOK_TABLE_COLS_COL_GROUP },
703 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_COLUMNS, XML_TOK_TABLE_COLS_HEADER_COLS },
704 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, XML_TOK_TABLE_COLS_COLS },
705 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, XML_TOK_TABLE_COLS_COL },
706 XML_TOKEN_MAP_END
709 pTableColsElemTokenMap = new SvXMLTokenMap( aTableColsElemTokenMap );
710 } // if( !pTableColsElemTokenMap )
712 return *pTableColsElemTokenMap;
715 const SvXMLTokenMap& ScXMLImport::GetTableAttrTokenMap()
717 if( !pTableAttrTokenMap )
719 static __FAR_DATA SvXMLTokenMapEntry aTableAttrTokenMap[] =
721 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_TABLE_NAME },
722 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_STYLE_NAME },
723 { XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TOK_TABLE_PROTECTED },
724 { XML_NAMESPACE_TABLE, XML_PRINT_RANGES, XML_TOK_TABLE_PRINT_RANGES },
725 { XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, XML_TOK_TABLE_PASSWORD },
726 { XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM, XML_TOK_TABLE_PASSHASH },
727 { XML_NAMESPACE_TABLE, XML_PROTECTION_KEY_DIGEST_ALGORITHM_2, XML_TOK_TABLE_PASSHASH_2 },
728 { XML_NAMESPACE_TABLE, XML_PRINT, XML_TOK_TABLE_PRINT },
729 XML_TOKEN_MAP_END
732 pTableAttrTokenMap = new SvXMLTokenMap( aTableAttrTokenMap );
733 } // if( !pTableAttrTokenMap )
735 return *pTableAttrTokenMap;
738 const SvXMLTokenMap& ScXMLImport::GetTableScenarioAttrTokenMap()
740 if( !pTableScenarioAttrTokenMap )
742 static __FAR_DATA SvXMLTokenMapEntry aTableScenarioAttrTokenMap[] =
744 { XML_NAMESPACE_TABLE, XML_DISPLAY_BORDER, XML_TOK_TABLE_SCENARIO_ATTR_DISPLAY_BORDER },
745 { XML_NAMESPACE_TABLE, XML_BORDER_COLOR, XML_TOK_TABLE_SCENARIO_ATTR_BORDER_COLOR },
746 { XML_NAMESPACE_TABLE, XML_COPY_BACK, XML_TOK_TABLE_SCENARIO_ATTR_COPY_BACK },
747 { XML_NAMESPACE_TABLE, XML_COPY_STYLES, XML_TOK_TABLE_SCENARIO_ATTR_COPY_STYLES },
748 { XML_NAMESPACE_TABLE, XML_COPY_FORMULAS, XML_TOK_TABLE_SCENARIO_ATTR_COPY_FORMULAS },
749 { XML_NAMESPACE_TABLE, XML_IS_ACTIVE, XML_TOK_TABLE_SCENARIO_ATTR_IS_ACTIVE },
750 { XML_NAMESPACE_TABLE, XML_SCENARIO_RANGES, XML_TOK_TABLE_SCENARIO_ATTR_SCENARIO_RANGES },
751 { XML_NAMESPACE_TABLE, XML_COMMENT, XML_TOK_TABLE_SCENARIO_ATTR_COMMENT },
752 { XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TOK_TABLE_SCENARIO_ATTR_PROTECTED },
753 XML_TOKEN_MAP_END
756 pTableScenarioAttrTokenMap = new SvXMLTokenMap( aTableScenarioAttrTokenMap );
757 } // if( !pTableScenarioAttrTokenMap )
759 return *pTableScenarioAttrTokenMap;
762 const SvXMLTokenMap& ScXMLImport::GetTableColAttrTokenMap()
764 if( !pTableColAttrTokenMap )
766 static __FAR_DATA SvXMLTokenMapEntry aTableColAttrTokenMap[] =
768 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_COL_ATTR_STYLE_NAME },
769 { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, XML_TOK_TABLE_COL_ATTR_REPEATED },
770 { XML_NAMESPACE_TABLE, XML_VISIBILITY, XML_TOK_TABLE_COL_ATTR_VISIBILITY },
771 { XML_NAMESPACE_TABLE, XML_DEFAULT_CELL_STYLE_NAME, XML_TOK_TABLE_COL_ATTR_DEFAULT_CELL_STYLE_NAME },
772 XML_TOKEN_MAP_END
775 pTableColAttrTokenMap = new SvXMLTokenMap( aTableColAttrTokenMap );
776 } // if( !pTableColAttrTokenMap )
778 return *pTableColAttrTokenMap;
781 const SvXMLTokenMap& ScXMLImport::GetTableRowElemTokenMap()
783 if( !pTableRowElemTokenMap )
785 static __FAR_DATA SvXMLTokenMapEntry aTableRowTokenMap[] =
787 { XML_NAMESPACE_TABLE, XML_TABLE_CELL, XML_TOK_TABLE_ROW_CELL },
788 { XML_NAMESPACE_TABLE, XML_COVERED_TABLE_CELL, XML_TOK_TABLE_ROW_COVERED_CELL },
789 XML_TOKEN_MAP_END
792 pTableRowElemTokenMap = new SvXMLTokenMap( aTableRowTokenMap );
793 } // if( !pTableRowElemTokenMap )
795 return *pTableRowElemTokenMap;
798 const SvXMLTokenMap& ScXMLImport::GetTableRowAttrTokenMap()
800 if( !pTableRowAttrTokenMap )
802 static __FAR_DATA SvXMLTokenMapEntry aTableRowAttrTokenMap[] =
804 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_ROW_ATTR_STYLE_NAME },
805 { XML_NAMESPACE_TABLE, XML_VISIBILITY, XML_TOK_TABLE_ROW_ATTR_VISIBILITY },
806 { XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_REPEATED, XML_TOK_TABLE_ROW_ATTR_REPEATED },
807 { XML_NAMESPACE_TABLE, XML_DEFAULT_CELL_STYLE_NAME, XML_TOK_TABLE_ROW_ATTR_DEFAULT_CELL_STYLE_NAME },
808 // { XML_NAMESPACE_TABLE, XML_USE_OPTIMAL_HEIGHT, XML_TOK_TABLE_ROW_ATTR_USE_OPTIMAL_HEIGHT },
809 XML_TOKEN_MAP_END
812 pTableRowAttrTokenMap = new SvXMLTokenMap( aTableRowAttrTokenMap );
813 } // if( !pTableRowAttrTokenMap )
815 return *pTableRowAttrTokenMap;
818 const SvXMLTokenMap& ScXMLImport::GetTableRowCellElemTokenMap()
820 if( !pTableRowCellElemTokenMap )
822 static __FAR_DATA SvXMLTokenMapEntry aTableRowCellTokenMap[] =
824 { XML_NAMESPACE_TEXT, XML_P, XML_TOK_TABLE_ROW_CELL_P },
825 { XML_NAMESPACE_TABLE, XML_SUB_TABLE, XML_TOK_TABLE_ROW_CELL_TABLE },
826 { XML_NAMESPACE_OFFICE, XML_ANNOTATION, XML_TOK_TABLE_ROW_CELL_ANNOTATION },
827 { XML_NAMESPACE_TABLE, XML_DETECTIVE, XML_TOK_TABLE_ROW_CELL_DETECTIVE },
828 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_SOURCE, XML_TOK_TABLE_ROW_CELL_CELL_RANGE_SOURCE },
829 XML_TOKEN_MAP_END
832 pTableRowCellElemTokenMap = new SvXMLTokenMap( aTableRowCellTokenMap );
833 } // if( !pTableRowCellElemTokenMap )
835 return *pTableRowCellElemTokenMap;
838 const SvXMLTokenMap& ScXMLImport::GetTableAnnotationAttrTokenMap()
840 if( !pTableAnnotationAttrTokenMap )
842 static __FAR_DATA SvXMLTokenMapEntry aTableAnnotationAttrTokenMap[] =
844 { XML_NAMESPACE_OFFICE, XML_AUTHOR, XML_TOK_TABLE_ANNOTATION_ATTR_AUTHOR },
845 { XML_NAMESPACE_OFFICE, XML_CREATE_DATE, XML_TOK_TABLE_ANNOTATION_ATTR_CREATE_DATE },
846 { XML_NAMESPACE_OFFICE, XML_CREATE_DATE_STRING, XML_TOK_TABLE_ANNOTATION_ATTR_CREATE_DATE_STRING },
847 { XML_NAMESPACE_OFFICE, XML_DISPLAY, XML_TOK_TABLE_ANNOTATION_ATTR_DISPLAY },
848 { XML_NAMESPACE_SVG, XML_X, XML_TOK_TABLE_ANNOTATION_ATTR_X },
849 { XML_NAMESPACE_SVG, XML_Y, XML_TOK_TABLE_ANNOTATION_ATTR_Y },
850 XML_TOKEN_MAP_END
853 pTableAnnotationAttrTokenMap = new SvXMLTokenMap( aTableAnnotationAttrTokenMap );
854 } // if( !pTableAnnotationAttrTokenMap )
856 return *pTableAnnotationAttrTokenMap;
859 const SvXMLTokenMap& ScXMLImport::GetDetectiveElemTokenMap()
861 if( !pDetectiveElemTokenMap )
863 static __FAR_DATA SvXMLTokenMapEntry aDetectiveElemTokenMap[]=
865 { XML_NAMESPACE_TABLE, XML_HIGHLIGHTED_RANGE, XML_TOK_DETECTIVE_ELEM_HIGHLIGHTED },
866 { XML_NAMESPACE_TABLE, XML_OPERATION, XML_TOK_DETECTIVE_ELEM_OPERATION },
867 XML_TOKEN_MAP_END
870 pDetectiveElemTokenMap = new SvXMLTokenMap( aDetectiveElemTokenMap );
871 } // if( !pDetectiveElemTokenMap )
873 return *pDetectiveElemTokenMap;
876 const SvXMLTokenMap& ScXMLImport::GetDetectiveHighlightedAttrTokenMap()
878 if( !pDetectiveHighlightedAttrTokenMap )
880 static __FAR_DATA SvXMLTokenMapEntry aDetectiveHighlightedAttrTokenMap[]=
882 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_CELL_RANGE },
883 { XML_NAMESPACE_TABLE, XML_DIRECTION, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_DIRECTION },
884 { XML_NAMESPACE_TABLE, XML_CONTAINS_ERROR, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_CONTAINS_ERROR },
885 { XML_NAMESPACE_TABLE, XML_MARKED_INVALID, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_MARKED_INVALID },
886 XML_TOKEN_MAP_END
889 pDetectiveHighlightedAttrTokenMap = new SvXMLTokenMap( aDetectiveHighlightedAttrTokenMap );
890 } // if( !pDetectiveHighlightedAttrTokenMap )
892 return *pDetectiveHighlightedAttrTokenMap;
895 const SvXMLTokenMap& ScXMLImport::GetDetectiveOperationAttrTokenMap()
897 if( !pDetectiveOperationAttrTokenMap )
899 static __FAR_DATA SvXMLTokenMapEntry aDetectiveOperationAttrTokenMap[]=
901 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DETECTIVE_OPERATION_ATTR_NAME },
902 { XML_NAMESPACE_TABLE, XML_INDEX, XML_TOK_DETECTIVE_OPERATION_ATTR_INDEX },
903 XML_TOKEN_MAP_END
906 pDetectiveOperationAttrTokenMap = new SvXMLTokenMap( aDetectiveOperationAttrTokenMap );
907 } // if( !pDetectiveOperationAttrTokenMap )
909 return *pDetectiveOperationAttrTokenMap;
912 const SvXMLTokenMap& ScXMLImport::GetTableCellRangeSourceAttrTokenMap()
914 if( !pTableCellRangeSourceAttrTokenMap )
916 static __FAR_DATA SvXMLTokenMapEntry aTableCellRangeSourceAttrTokenMap[] =
918 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_NAME },
919 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_HREF },
920 { XML_NAMESPACE_TABLE, XML_FILTER_NAME, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_NAME },
921 { XML_NAMESPACE_TABLE, XML_FILTER_OPTIONS, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_OPTIONS },
922 { XML_NAMESPACE_TABLE, XML_LAST_COLUMN_SPANNED, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_COLUMN },
923 { XML_NAMESPACE_TABLE, XML_LAST_ROW_SPANNED, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_ROW },
924 { XML_NAMESPACE_TABLE, XML_REFRESH_DELAY, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_REFRESH_DELAY },
925 XML_TOKEN_MAP_END
928 pTableCellRangeSourceAttrTokenMap = new SvXMLTokenMap( aTableCellRangeSourceAttrTokenMap );
929 } // if( !pTableCellRangeSourceAttrTokenMap )
931 return *pTableCellRangeSourceAttrTokenMap;
934 const SvXMLTokenMap& ScXMLImport::GetNamedExpressionsElemTokenMap()
936 if( !pNamedExpressionsElemTokenMap )
938 static __FAR_DATA SvXMLTokenMapEntry aNamedExpressionsTokenMap[] =
940 { XML_NAMESPACE_TABLE, XML_NAMED_RANGE, XML_TOK_NAMED_EXPRESSIONS_NAMED_RANGE },
941 { XML_NAMESPACE_TABLE, XML_NAMED_EXPRESSION, XML_TOK_NAMED_EXPRESSIONS_NAMED_EXPRESSION },
942 XML_TOKEN_MAP_END
945 pNamedExpressionsElemTokenMap = new SvXMLTokenMap( aNamedExpressionsTokenMap );
946 } // if( !pNamedExpressionsElemTokenMap )
948 return *pNamedExpressionsElemTokenMap;
951 const SvXMLTokenMap& ScXMLImport::GetNamedRangeAttrTokenMap()
953 if( !pNamedRangeAttrTokenMap )
955 static __FAR_DATA SvXMLTokenMapEntry aNamedRangeAttrTokenMap[] =
957 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_NAMED_RANGE_ATTR_NAME },
958 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, XML_TOK_NAMED_RANGE_ATTR_CELL_RANGE_ADDRESS },
959 { XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, XML_TOK_NAMED_RANGE_ATTR_BASE_CELL_ADDRESS },
960 { XML_NAMESPACE_TABLE, XML_RANGE_USABLE_AS, XML_TOK_NAMED_RANGE_ATTR_RANGE_USABLE_AS },
961 XML_TOKEN_MAP_END
964 pNamedRangeAttrTokenMap = new SvXMLTokenMap( aNamedRangeAttrTokenMap );
965 } // if( !pNamedRangeAttrTokenMap )
967 return *pNamedRangeAttrTokenMap;
970 const SvXMLTokenMap& ScXMLImport::GetNamedExpressionAttrTokenMap()
972 if( !pNamedExpressionAttrTokenMap )
974 static __FAR_DATA SvXMLTokenMapEntry aNamedExpressionAttrTokenMap[] =
976 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_NAMED_EXPRESSION_ATTR_NAME },
977 { XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, XML_TOK_NAMED_EXPRESSION_ATTR_BASE_CELL_ADDRESS },
978 { XML_NAMESPACE_TABLE, XML_EXPRESSION, XML_TOK_NAMED_EXPRESSION_ATTR_EXPRESSION },
979 XML_TOKEN_MAP_END
982 pNamedExpressionAttrTokenMap = new SvXMLTokenMap( aNamedExpressionAttrTokenMap );
983 } // if( !pNamedExpressionAttrTokenMap )
985 return *pNamedExpressionAttrTokenMap;
988 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangesElemTokenMap()
990 if( !pDatabaseRangesElemTokenMap )
992 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangesTokenMap[] =
994 { XML_NAMESPACE_TABLE, XML_DATABASE_RANGE, XML_TOK_DATABASE_RANGE },
995 XML_TOKEN_MAP_END
998 pDatabaseRangesElemTokenMap = new SvXMLTokenMap( aDatabaseRangesTokenMap );
999 } // if( !pDatabaseRangesElemTokenMap )
1001 return *pDatabaseRangesElemTokenMap;
1004 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeElemTokenMap()
1006 if( !pDatabaseRangeElemTokenMap )
1008 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangeTokenMap[] =
1010 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_SQL, XML_TOK_DATABASE_RANGE_SOURCE_SQL },
1011 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_TABLE, XML_TOK_DATABASE_RANGE_SOURCE_TABLE },
1012 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_QUERY, XML_TOK_DATABASE_RANGE_SOURCE_QUERY },
1013 { XML_NAMESPACE_TABLE, XML_FILTER, XML_TOK_FILTER },
1014 { XML_NAMESPACE_TABLE, XML_SORT, XML_TOK_SORT },
1015 { XML_NAMESPACE_TABLE, XML_SUBTOTAL_RULES, XML_TOK_DATABASE_RANGE_SUBTOTAL_RULES },
1016 XML_TOKEN_MAP_END
1019 pDatabaseRangeElemTokenMap = new SvXMLTokenMap( aDatabaseRangeTokenMap );
1020 } // if( !pDatabaseRangeElemTokenMap )
1022 return *pDatabaseRangeElemTokenMap;
1025 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeAttrTokenMap()
1027 if( !pDatabaseRangeAttrTokenMap )
1029 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangeAttrTokenMap[] =
1031 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DATABASE_RANGE_ATTR_NAME },
1032 { XML_NAMESPACE_TABLE, XML_IS_SELECTION, XML_TOK_DATABASE_RANGE_ATTR_IS_SELECTION },
1033 { XML_NAMESPACE_TABLE, XML_ON_UPDATE_KEEP_STYLES, XML_TOK_DATABASE_RANGE_ATTR_ON_UPDATE_KEEP_STYLES },
1034 { XML_NAMESPACE_TABLE, XML_ON_UPDATE_KEEP_SIZE, XML_TOK_DATABASE_RANGE_ATTR_ON_UPDATE_KEEP_SIZE },
1035 { XML_NAMESPACE_TABLE, XML_HAS_PERSISTENT_DATA, XML_TOK_DATABASE_RANGE_ATTR_HAS_PERSISTENT_DATA },
1036 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_DATABASE_RANGE_ATTR_ORIENTATION },
1037 { XML_NAMESPACE_TABLE, XML_CONTAINS_HEADER, XML_TOK_DATABASE_RANGE_ATTR_CONTAINS_HEADER },
1038 { XML_NAMESPACE_TABLE, XML_DISPLAY_FILTER_BUTTONS, XML_TOK_DATABASE_RANGE_ATTR_DISPLAY_FILTER_BUTTONS },
1039 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_DATABASE_RANGE_ATTR_TARGET_RANGE_ADDRESS },
1040 { XML_NAMESPACE_TABLE, XML_REFRESH_DELAY, XML_TOK_DATABASE_RANGE_ATTR_REFRESH_DELAY },
1041 XML_TOKEN_MAP_END
1044 pDatabaseRangeAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeAttrTokenMap );
1045 } // if( !pDatabaseRangeAttrTokenMap )
1047 return *pDatabaseRangeAttrTokenMap;
1050 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSourceSQLAttrTokenMap()
1052 if( !pDatabaseRangeSourceSQLAttrTokenMap )
1054 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangeSourceSQLAttrTokenMap[] =
1056 { XML_NAMESPACE_TABLE, XML_DATABASE_NAME, XML_TOK_SOURCE_SQL_ATTR_DATABASE_NAME },
1057 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SOURCE_SQL_ATTR_HREF },
1058 { XML_NAMESPACE_TABLE, XML_CONNECTION_RESOURCE, XML_TOK_SOURCE_SQL_ATTR_CONNECTION_RESSOURCE},
1059 { XML_NAMESPACE_TABLE, XML_SQL_STATEMENT, XML_TOK_SOURCE_SQL_ATTR_SQL_STATEMENT },
1060 { XML_NAMESPACE_TABLE, XML_PARSE_SQL_STATEMENT, XML_TOK_SOURCE_SQL_ATTR_PARSE_SQL_STATEMENT },
1061 XML_TOKEN_MAP_END
1064 pDatabaseRangeSourceSQLAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSourceSQLAttrTokenMap );
1065 } // if( !pDatabaseRangeSourceSQLAttrTokenMap )
1067 return *pDatabaseRangeSourceSQLAttrTokenMap;
1070 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSourceTableAttrTokenMap()
1072 if( !pDatabaseRangeSourceTableAttrTokenMap )
1074 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangeSourceTableAttrTokenMap[] =
1076 { XML_NAMESPACE_TABLE, XML_DATABASE_NAME, XML_TOK_SOURCE_TABLE_ATTR_DATABASE_NAME },
1077 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SOURCE_TABLE_ATTR_HREF },
1078 { XML_NAMESPACE_TABLE, XML_CONNECTION_RESOURCE, XML_TOK_SOURCE_TABLE_ATTR_CONNECTION_RESSOURCE },
1079 { XML_NAMESPACE_TABLE, XML_TABLE_NAME, XML_TOK_SOURCE_TABLE_ATTR_TABLE_NAME },
1080 XML_TOKEN_MAP_END
1083 pDatabaseRangeSourceTableAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSourceTableAttrTokenMap );
1084 } // if( !pDatabaseRangeSourceTableAttrTokenMap )
1086 return *pDatabaseRangeSourceTableAttrTokenMap;
1089 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSourceQueryAttrTokenMap()
1091 if( !pDatabaseRangeSourceQueryAttrTokenMap )
1093 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangeSourceQueryAttrTokenMap[] =
1095 { XML_NAMESPACE_TABLE, XML_DATABASE_NAME, XML_TOK_SOURCE_QUERY_ATTR_DATABASE_NAME },
1096 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SOURCE_QUERY_ATTR_HREF },
1097 { XML_NAMESPACE_TABLE, XML_CONNECTION_RESOURCE, XML_TOK_SOURCE_QUERY_ATTR_CONNECTION_RESSOURCE },
1098 { XML_NAMESPACE_TABLE, XML_QUERY_NAME, XML_TOK_SOURCE_QUERY_ATTR_QUERY_NAME },
1099 XML_TOKEN_MAP_END
1102 pDatabaseRangeSourceQueryAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSourceQueryAttrTokenMap );
1103 } // if( !pDatabaseRangeSourceQueryAttrTokenMap )
1105 return *pDatabaseRangeSourceQueryAttrTokenMap;
1108 const SvXMLTokenMap& ScXMLImport::GetFilterElemTokenMap()
1110 if( !pFilterElemTokenMap )
1112 static __FAR_DATA SvXMLTokenMapEntry aFilterTokenMap[] =
1114 { XML_NAMESPACE_TABLE, XML_FILTER_AND, XML_TOK_FILTER_AND },
1115 { XML_NAMESPACE_TABLE, XML_FILTER_OR, XML_TOK_FILTER_OR },
1116 { XML_NAMESPACE_TABLE, XML_FILTER_CONDITION, XML_TOK_FILTER_CONDITION },
1117 XML_TOKEN_MAP_END
1120 pFilterElemTokenMap = new SvXMLTokenMap( aFilterTokenMap );
1121 } // if( !pFilterElemTokenMap )
1123 return *pFilterElemTokenMap;
1126 const SvXMLTokenMap& ScXMLImport::GetFilterAttrTokenMap()
1128 if( !pFilterAttrTokenMap )
1130 static __FAR_DATA SvXMLTokenMapEntry aFilterAttrTokenMap[] =
1132 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_FILTER_ATTR_TARGET_RANGE_ADDRESS },
1133 { XML_NAMESPACE_TABLE, XML_CONDITION_SOURCE_RANGE_ADDRESS, XML_TOK_FILTER_ATTR_CONDITION_SOURCE_RANGE_ADDRESS },
1134 { XML_NAMESPACE_TABLE, XML_CONDITION_SOURCE, XML_TOK_FILTER_ATTR_CONDITION_SOURCE },
1135 { XML_NAMESPACE_TABLE, XML_DISPLAY_DUPLICATES, XML_TOK_FILTER_ATTR_DISPLAY_DUPLICATES },
1136 XML_TOKEN_MAP_END
1139 pFilterAttrTokenMap = new SvXMLTokenMap( aFilterAttrTokenMap );
1140 } // if( !pFilterAttrTokenMap )
1142 return *pFilterAttrTokenMap;
1145 const SvXMLTokenMap& ScXMLImport::GetFilterConditionAttrTokenMap()
1147 if( !pFilterConditionAttrTokenMap )
1149 static __FAR_DATA SvXMLTokenMapEntry aFilterConditionAttrTokenMap[] =
1151 { XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, XML_TOK_CONDITION_ATTR_FIELD_NUMBER },
1152 { XML_NAMESPACE_TABLE, XML_CASE_SENSITIVE, XML_TOK_CONDITION_ATTR_CASE_SENSITIVE },
1153 { XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TOK_CONDITION_ATTR_DATA_TYPE },
1154 { XML_NAMESPACE_TABLE, XML_VALUE, XML_TOK_CONDITION_ATTR_VALUE },
1155 { XML_NAMESPACE_TABLE, XML_OPERATOR, XML_TOK_CONDITION_ATTR_OPERATOR },
1156 XML_TOKEN_MAP_END
1159 pFilterConditionAttrTokenMap = new SvXMLTokenMap( aFilterConditionAttrTokenMap );
1160 } // if( !pFilterConditionAttrTokenMap )
1162 return *pFilterConditionAttrTokenMap;
1165 const SvXMLTokenMap& ScXMLImport::GetSortElemTokenMap()
1167 if( !pSortElemTokenMap )
1169 static __FAR_DATA SvXMLTokenMapEntry aSortTokenMap[] =
1171 { XML_NAMESPACE_TABLE, XML_SORT_BY, XML_TOK_SORT_SORT_BY },
1172 XML_TOKEN_MAP_END
1175 pSortElemTokenMap = new SvXMLTokenMap( aSortTokenMap );
1176 } // if( !pSortElemTokenMap )
1178 return *pSortElemTokenMap;
1181 const SvXMLTokenMap& ScXMLImport::GetSortAttrTokenMap()
1183 if( !pSortAttrTokenMap )
1185 static __FAR_DATA SvXMLTokenMapEntry aSortAttrTokenMap[] =
1187 { XML_NAMESPACE_TABLE, XML_BIND_STYLES_TO_CONTENT, XML_TOK_SORT_ATTR_BIND_STYLES_TO_CONTENT },
1188 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_SORT_ATTR_TARGET_RANGE_ADDRESS },
1189 { XML_NAMESPACE_TABLE, XML_CASE_SENSITIVE, XML_TOK_SORT_ATTR_CASE_SENSITIVE },
1190 { XML_NAMESPACE_TABLE, XML_LANGUAGE, XML_TOK_SORT_ATTR_LANGUAGE },
1191 { XML_NAMESPACE_TABLE, XML_COUNTRY, XML_TOK_SORT_ATTR_COUNTRY },
1192 { XML_NAMESPACE_TABLE, XML_ALGORITHM, XML_TOK_SORT_ATTR_ALGORITHM },
1193 XML_TOKEN_MAP_END
1196 pSortAttrTokenMap = new SvXMLTokenMap( aSortAttrTokenMap );
1197 } // if( !pSortAttrTokenMap )
1199 return *pSortAttrTokenMap;
1202 const SvXMLTokenMap& ScXMLImport::GetSortSortByAttrTokenMap()
1204 if( !pSortSortByAttrTokenMap )
1206 static __FAR_DATA SvXMLTokenMapEntry aSortSortByAttrTokenMap[] =
1208 { XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, XML_TOK_SORT_BY_ATTR_FIELD_NUMBER },
1209 { XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TOK_SORT_BY_ATTR_DATA_TYPE },
1210 { XML_NAMESPACE_TABLE, XML_ORDER, XML_TOK_SORT_BY_ATTR_ORDER },
1211 XML_TOKEN_MAP_END
1214 pSortSortByAttrTokenMap = new SvXMLTokenMap( aSortSortByAttrTokenMap );
1215 } // if( !pSortSortByAttrTokenMap )
1217 return *pSortSortByAttrTokenMap;
1220 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSubTotalRulesElemTokenMap()
1222 if( !pDatabaseRangeSubTotalRulesElemTokenMap )
1224 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangeSubTotalRulesTokenMap[] =
1226 { XML_NAMESPACE_TABLE, XML_SORT_GROUPS, XML_TOK_SUBTOTAL_RULES_SORT_GROUPS },
1227 { XML_NAMESPACE_TABLE, XML_SUBTOTAL_RULE, XML_TOK_SUBTOTAL_RULES_SUBTOTAL_RULE },
1228 XML_TOKEN_MAP_END
1231 pDatabaseRangeSubTotalRulesElemTokenMap = new SvXMLTokenMap( aDatabaseRangeSubTotalRulesTokenMap );
1232 } // if( !pDatabaseRangeSubTotalRulesElemTokenMap )
1234 return *pDatabaseRangeSubTotalRulesElemTokenMap;
1237 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSubTotalRulesAttrTokenMap()
1239 if( !pDatabaseRangeSubTotalRulesAttrTokenMap )
1241 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangeSubTotalRulesAttrTokenMap[] =
1243 { XML_NAMESPACE_TABLE, XML_BIND_STYLES_TO_CONTENT, XML_TOK_SUBTOTAL_RULES_ATTR_BIND_STYLES_TO_CONTENT },
1244 { XML_NAMESPACE_TABLE, XML_CASE_SENSITIVE, XML_TOK_SUBTOTAL_RULES_ATTR_CASE_SENSITIVE },
1245 { XML_NAMESPACE_TABLE, XML_PAGE_BREAKS_ON_GROUP_CHANGE, XML_TOK_SUBTOTAL_RULES_ATTR_PAGE_BREAKS_ON_GROUP_CHANGE },
1246 XML_TOKEN_MAP_END
1249 pDatabaseRangeSubTotalRulesAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSubTotalRulesAttrTokenMap );
1250 } // if( !pDatabaseRangeSubTotalRulesAttrTokenMap )
1252 return *pDatabaseRangeSubTotalRulesAttrTokenMap;
1255 const SvXMLTokenMap& ScXMLImport::GetSubTotalRulesSortGroupsAttrTokenMap()
1257 if( !pSubTotalRulesSortGroupsAttrTokenMap )
1259 static __FAR_DATA SvXMLTokenMapEntry aSubTotalRulesSortGroupsAttrTokenMap[] =
1261 { XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TOK_SORT_GROUPS_ATTR_DATA_TYPE },
1262 { XML_NAMESPACE_TABLE, XML_ORDER, XML_TOK_SORT_GROUPS_ATTR_ORDER },
1263 XML_TOKEN_MAP_END
1266 pSubTotalRulesSortGroupsAttrTokenMap = new SvXMLTokenMap( aSubTotalRulesSortGroupsAttrTokenMap );
1267 } // if( !pSubTotalRulesSortGroupsAttrTokenMap )
1269 return *pSubTotalRulesSortGroupsAttrTokenMap;
1272 const SvXMLTokenMap& ScXMLImport::GetSubTotalRulesSubTotalRuleElemTokenMap()
1274 if( !pSubTotalRulesSubTotalRuleElemTokenMap )
1276 static __FAR_DATA SvXMLTokenMapEntry aSubTotalRulesSubTotalRuleTokenMap[] =
1278 { XML_NAMESPACE_TABLE, XML_SUBTOTAL_FIELD, XML_TOK_SUBTOTAL_RULE_SUBTOTAL_FIELD },
1279 XML_TOKEN_MAP_END
1282 pSubTotalRulesSubTotalRuleElemTokenMap = new SvXMLTokenMap( aSubTotalRulesSubTotalRuleTokenMap );
1283 } // if( !pSubTotalRulesSubTotalRuleElemTokenMap )
1285 return *pSubTotalRulesSubTotalRuleElemTokenMap;
1288 const SvXMLTokenMap& ScXMLImport::GetSubTotalRulesSubTotalRuleAttrTokenMap()
1290 if( !pSubTotalRulesSubTotalRuleAttrTokenMap )
1292 static __FAR_DATA SvXMLTokenMapEntry aSubTotalRulesSubTotalRuleAttrTokenMap[] =
1294 { XML_NAMESPACE_TABLE, XML_GROUP_BY_FIELD_NUMBER, XML_TOK_SUBTOTAL_RULE_ATTR_GROUP_BY_FIELD_NUMBER },
1295 XML_TOKEN_MAP_END
1298 pSubTotalRulesSubTotalRuleAttrTokenMap = new SvXMLTokenMap( aSubTotalRulesSubTotalRuleAttrTokenMap );
1299 } // if( !pSubTotalRulesSubTotalRuleAttrTokenMap )
1301 return *pSubTotalRulesSubTotalRuleAttrTokenMap;
1304 const SvXMLTokenMap& ScXMLImport::GetSubTotalRuleSubTotalFieldAttrTokenMap()
1306 if( !pSubTotalRuleSubTotalFieldAttrTokenMap )
1308 static __FAR_DATA SvXMLTokenMapEntry aSubTotalRuleSubTotalFieldAttrTokenMap[] =
1310 { XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, XML_TOK_SUBTOTAL_FIELD_ATTR_FIELD_NUMBER },
1311 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_SUBTOTAL_FIELD_ATTR_FUNCTION },
1312 XML_TOKEN_MAP_END
1315 pSubTotalRuleSubTotalFieldAttrTokenMap = new SvXMLTokenMap( aSubTotalRuleSubTotalFieldAttrTokenMap );
1316 } // if( !pSubTotalRuleSubTotalFieldAttrTokenMap )
1318 return *pSubTotalRuleSubTotalFieldAttrTokenMap;
1321 const SvXMLTokenMap& ScXMLImport::GetDataPilotTablesElemTokenMap()
1323 if( !pDataPilotTablesElemTokenMap )
1325 static __FAR_DATA SvXMLTokenMapEntry aDataPilotTablesElemTokenMap[] =
1327 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_TABLE, XML_TOK_DATA_PILOT_TABLE },
1328 XML_TOKEN_MAP_END
1331 pDataPilotTablesElemTokenMap = new SvXMLTokenMap( aDataPilotTablesElemTokenMap );
1332 } // if( !pDataPilotTablesElemTokenMap )
1334 return *pDataPilotTablesElemTokenMap;
1337 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableAttrTokenMap()
1339 if( !pDataPilotTableAttrTokenMap )
1341 static __FAR_DATA SvXMLTokenMapEntry aDataPilotTableAttrTokenMap[] =
1343 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DATA_PILOT_TABLE_ATTR_NAME },
1344 { XML_NAMESPACE_TABLE, XML_APPLICATION_DATA, XML_TOK_DATA_PILOT_TABLE_ATTR_APPLICATION_DATA },
1345 { XML_NAMESPACE_TABLE, XML_GRAND_TOTAL, XML_TOK_DATA_PILOT_TABLE_ATTR_GRAND_TOTAL },
1346 { XML_NAMESPACE_TABLE, XML_IGNORE_EMPTY_ROWS, XML_TOK_DATA_PILOT_TABLE_ATTR_IGNORE_EMPTY_ROWS },
1347 { XML_NAMESPACE_TABLE, XML_IDENTIFY_CATEGORIES, XML_TOK_DATA_PILOT_TABLE_ATTR_IDENTIFY_CATEGORIES },
1348 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_DATA_PILOT_TABLE_ATTR_TARGET_RANGE_ADDRESS },
1349 { XML_NAMESPACE_TABLE, XML_BUTTONS, XML_TOK_DATA_PILOT_TABLE_ATTR_BUTTONS },
1350 { XML_NAMESPACE_TABLE, XML_SHOW_FILTER_BUTTON, XML_TOK_DATA_PILOT_TABLE_ATTR_SHOW_FILTER_BUTTON },
1351 { XML_NAMESPACE_TABLE, XML_DRILL_DOWN_ON_DOUBLE_CLICK, XML_TOK_DATA_PILOT_TABLE_ATTR_DRILL_DOWN },
1352 { XML_NAMESPACE_TABLE, XML_HEADER_GRID_LAYOUT, XML_TOK_DATA_PILOT_TABLE_ATTR_HEADER_GRID_LAYOUT },
1353 XML_TOKEN_MAP_END
1356 pDataPilotTableAttrTokenMap = new SvXMLTokenMap( aDataPilotTableAttrTokenMap );
1357 } // if( !pDataPilotTableAttrTokenMap )
1359 return *pDataPilotTableAttrTokenMap;
1362 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableElemTokenMap()
1364 if( !pDataPilotTableElemTokenMap )
1366 static __FAR_DATA SvXMLTokenMapEntry aDataPilotTableElemTokenMap[] =
1368 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_SQL, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_SQL },
1369 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_TABLE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_TABLE },
1370 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_GRAND_TOTAL, XML_TOK_DATA_PILOT_TABLE_ELEM_GRAND_TOTAL },
1371 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_QUERY, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_QUERY },
1372 { XML_NAMESPACE_TABLE, XML_SOURCE_SERVICE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_SERVICE },
1373 { XML_NAMESPACE_TABLE, XML_SOURCE_CELL_RANGE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_CELL_RANGE },
1374 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_FIELD, XML_TOK_DATA_PILOT_TABLE_ELEM_DATA_PILOT_FIELD },
1375 XML_TOKEN_MAP_END
1378 pDataPilotTableElemTokenMap = new SvXMLTokenMap( aDataPilotTableElemTokenMap );
1379 } // if( !pDataPilotTableElemTokenMap )
1381 return *pDataPilotTableElemTokenMap;
1384 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableSourceServiceAttrTokenMap()
1386 if( !pDataPilotTableSourceServiceAttrTokenMap )
1388 static __FAR_DATA SvXMLTokenMapEntry aDataPilotTableSourceServiceAttrTokenMap[] =
1390 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_SOURCE_SERVICE_ATTR_NAME },
1391 { XML_NAMESPACE_TABLE, XML_SOURCE_NAME, XML_TOK_SOURCE_SERVICE_ATTR_SOURCE_NAME },
1392 { XML_NAMESPACE_TABLE, XML_OBJECT_NAME, XML_TOK_SOURCE_SERVICE_ATTR_OBJECT_NAME },
1393 { XML_NAMESPACE_TABLE, XML_USER_NAME, XML_TOK_SOURCE_SERVICE_ATTR_USER_NAME },
1394 { XML_NAMESPACE_TABLE, XML_PASSWORT, XML_TOK_SOURCE_SERVICE_ATTR_PASSWORD },
1395 XML_TOKEN_MAP_END
1398 pDataPilotTableSourceServiceAttrTokenMap = new SvXMLTokenMap( aDataPilotTableSourceServiceAttrTokenMap );
1399 } // if( !pDataPilotTableSourceServiceAttrTokenMap )
1401 return *pDataPilotTableSourceServiceAttrTokenMap;
1404 const SvXMLTokenMap& ScXMLImport::GetDataPilotGrandTotalAttrTokenMap()
1406 if (!pDataPilotGrandTotalAttrTokenMap)
1408 static __FAR_DATA SvXMLTokenMapEntry aDataPilotGrandTotalAttrTokenMap[] =
1410 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_DATA_PILOT_GRAND_TOTAL_ATTR_DISPLAY },
1411 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_DATA_PILOT_GRAND_TOTAL_ATTR_ORIENTATION },
1412 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_GRAND_TOTAL_ATTR_DISPLAY_NAME },
1413 XML_TOKEN_MAP_END
1416 pDataPilotGrandTotalAttrTokenMap = new SvXMLTokenMap( aDataPilotGrandTotalAttrTokenMap );
1419 return *pDataPilotGrandTotalAttrTokenMap;
1422 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableSourceCellRangeAttrTokenMap()
1424 if( !pDataPilotTableSourceCellRangeAttrTokenMap )
1426 static __FAR_DATA SvXMLTokenMapEntry aDataPilotTableSourceCellRangeAttrTokenMap[] =
1428 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, XML_TOK_SOURCE_CELL_RANGE_ATTR_CELL_RANGE_ADDRESS},
1429 XML_TOKEN_MAP_END
1432 pDataPilotTableSourceCellRangeAttrTokenMap = new SvXMLTokenMap( aDataPilotTableSourceCellRangeAttrTokenMap );
1433 } // if( !pDataPilotTableSourceCellRangeAttrTokenMap )
1435 return *pDataPilotTableSourceCellRangeAttrTokenMap;
1438 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableSourceCellRangeElemTokenMap()
1440 if( !pDataPilotTableSourceCellRangeElemTokenMap )
1442 static __FAR_DATA SvXMLTokenMapEntry aDataPilotTableSourceCellRangeElemTokenMap[] =
1444 { XML_NAMESPACE_TABLE, XML_FILTER, XML_TOK_SOURCE_CELL_RANGE_ELEM_FILTER},
1445 XML_TOKEN_MAP_END
1448 pDataPilotTableSourceCellRangeElemTokenMap = new SvXMLTokenMap( aDataPilotTableSourceCellRangeElemTokenMap );
1449 } // if( !pDataPilotTableSourceCellRangeElemTokenMap )
1451 return *pDataPilotTableSourceCellRangeElemTokenMap;
1454 const SvXMLTokenMap& ScXMLImport::GetDataPilotFieldAttrTokenMap()
1456 if( !pDataPilotFieldAttrTokenMap )
1458 static __FAR_DATA SvXMLTokenMapEntry aDataPilotFieldAttrTokenMap[] =
1460 { XML_NAMESPACE_TABLE, XML_SOURCE_FIELD_NAME, XML_TOK_DATA_PILOT_FIELD_ATTR_SOURCE_FIELD_NAME },
1461 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_FIELD_ATTR_DISPLAY_NAME },
1462 { XML_NAMESPACE_TABLE, XML_IS_DATA_LAYOUT_FIELD, XML_TOK_DATA_PILOT_FIELD_ATTR_IS_DATA_LAYOUT_FIELD },
1463 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_DATA_PILOT_FIELD_ATTR_FUNCTION },
1464 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_DATA_PILOT_FIELD_ATTR_ORIENTATION },
1465 { XML_NAMESPACE_TABLE, XML_SELECTED_PAGE, XML_TOK_DATA_PILOT_FIELD_ATTR_SELECTED_PAGE },
1466 { XML_NAMESPACE_TABLE, XML_USED_HIERARCHY, XML_TOK_DATA_PILOT_FIELD_ATTR_USED_HIERARCHY },
1467 XML_TOKEN_MAP_END
1470 pDataPilotFieldAttrTokenMap = new SvXMLTokenMap( aDataPilotFieldAttrTokenMap );
1471 } // if( !pDataPilotFieldAttrTokenMap )
1473 return *pDataPilotFieldAttrTokenMap;
1476 const SvXMLTokenMap& ScXMLImport::GetDataPilotFieldElemTokenMap()
1478 if( !pDataPilotFieldElemTokenMap )
1480 static __FAR_DATA SvXMLTokenMapEntry aDataPilotFieldElemTokenMap[] =
1482 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_LEVEL, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_LEVEL },
1483 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_FIELD_REFERENCE, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_REFERENCE },
1484 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUPS, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_GROUPS },
1485 XML_TOKEN_MAP_END
1488 pDataPilotFieldElemTokenMap = new SvXMLTokenMap( aDataPilotFieldElemTokenMap );
1489 } // if( !pDataPilotFieldElemTokenMap )
1491 return *pDataPilotFieldElemTokenMap;
1494 const SvXMLTokenMap& ScXMLImport::GetDataPilotLevelAttrTokenMap()
1496 if( !pDataPilotLevelAttrTokenMap )
1498 static __FAR_DATA SvXMLTokenMapEntry aDataPilotLevelAttrTokenMap[] =
1500 { XML_NAMESPACE_TABLE, XML_SHOW_EMPTY, XML_TOK_DATA_PILOT_LEVEL_ATTR_SHOW_EMPTY },
1501 XML_TOKEN_MAP_END
1504 pDataPilotLevelAttrTokenMap = new SvXMLTokenMap( aDataPilotLevelAttrTokenMap );
1505 } // if( !pDataPilotLevelAttrTokenMap )
1507 return *pDataPilotLevelAttrTokenMap;
1510 const SvXMLTokenMap& ScXMLImport::GetDataPilotLevelElemTokenMap()
1512 if( !pDataPilotLevelElemTokenMap )
1514 static __FAR_DATA SvXMLTokenMapEntry aDataPilotLevelElemTokenMap[] =
1516 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_SUBTOTALS, XML_TOK_DATA_PILOT_LEVEL_ELEM_DATA_PILOT_SUBTOTALS },
1517 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_MEMBERS, XML_TOK_DATA_PILOT_LEVEL_ELEM_DATA_PILOT_MEMBERS },
1518 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_DISPLAY_INFO, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_DISPLAY_INFO },
1519 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_SORT_INFO, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_SORT_INFO },
1520 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_LAYOUT_INFO, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_LAYOUT_INFO },
1521 XML_TOKEN_MAP_END
1524 pDataPilotLevelElemTokenMap = new SvXMLTokenMap( aDataPilotLevelElemTokenMap );
1525 } // if( !pDataPilotLevelElemTokenMap )
1527 return *pDataPilotLevelElemTokenMap;
1530 const SvXMLTokenMap& ScXMLImport::GetDataPilotSubTotalsElemTokenMap()
1532 if( !pDataPilotSubTotalsElemTokenMap )
1534 static __FAR_DATA SvXMLTokenMapEntry aDataPilotSubTotalsElemTokenMap[] =
1536 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_SUBTOTAL, XML_TOK_DATA_PILOT_SUBTOTALS_ELEM_DATA_PILOT_SUBTOTAL },
1537 XML_TOKEN_MAP_END
1540 pDataPilotSubTotalsElemTokenMap = new SvXMLTokenMap( aDataPilotSubTotalsElemTokenMap );
1541 } // if( !pDataPilotSubTotalsElemTokenMap )
1543 return *pDataPilotSubTotalsElemTokenMap;
1546 const SvXMLTokenMap& ScXMLImport::GetDataPilotSubTotalAttrTokenMap()
1548 if( !pDataPilotSubTotalAttrTokenMap )
1550 static __FAR_DATA SvXMLTokenMapEntry aDataPilotSubTotalAttrTokenMap[] =
1552 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_DATA_PILOT_SUBTOTAL_ATTR_FUNCTION },
1553 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_SUBTOTAL_ATTR_DISPLAY_NAME },
1554 XML_TOKEN_MAP_END
1557 pDataPilotSubTotalAttrTokenMap = new SvXMLTokenMap( aDataPilotSubTotalAttrTokenMap );
1558 } // if( !pDataPilotSubTotalAttrTokenMap )
1560 return *pDataPilotSubTotalAttrTokenMap;
1563 const SvXMLTokenMap& ScXMLImport::GetDataPilotMembersElemTokenMap()
1565 if( !pDataPilotMembersElemTokenMap )
1567 static __FAR_DATA SvXMLTokenMapEntry aDataPilotMembersElemTokenMap[] =
1569 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_MEMBER, XML_TOK_DATA_PILOT_MEMBERS_ELEM_DATA_PILOT_MEMBER },
1570 XML_TOKEN_MAP_END
1573 pDataPilotMembersElemTokenMap = new SvXMLTokenMap( aDataPilotMembersElemTokenMap );
1574 } // if( !pDataPilotMembersElemTokenMap )
1576 return *pDataPilotMembersElemTokenMap;
1579 const SvXMLTokenMap& ScXMLImport::GetDataPilotMemberAttrTokenMap()
1581 if( !pDataPilotMemberAttrTokenMap )
1583 static __FAR_DATA SvXMLTokenMapEntry aDataPilotMemberAttrTokenMap[] =
1585 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DATA_PILOT_MEMBER_ATTR_NAME },
1586 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_MEMBER_ATTR_DISPLAY_NAME },
1587 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_DATA_PILOT_MEMBER_ATTR_DISPLAY },
1588 { XML_NAMESPACE_TABLE, XML_SHOW_DETAILS, XML_TOK_DATA_PILOT_MEMBER_ATTR_SHOW_DETAILS },
1589 XML_TOKEN_MAP_END
1592 pDataPilotMemberAttrTokenMap = new SvXMLTokenMap( aDataPilotMemberAttrTokenMap );
1593 } // if( !pDataPilotMemberAttrTokenMap )
1595 return *pDataPilotMemberAttrTokenMap;
1598 const SvXMLTokenMap& ScXMLImport::GetConsolidationAttrTokenMap()
1600 if( !pConsolidationAttrTokenMap )
1602 static __FAR_DATA SvXMLTokenMapEntry aConsolidationAttrTokenMap[] =
1604 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_CONSOLIDATION_ATTR_FUNCTION },
1605 { XML_NAMESPACE_TABLE, XML_SOURCE_CELL_RANGE_ADDRESSES, XML_TOK_CONSOLIDATION_ATTR_SOURCE_RANGES },
1606 { XML_NAMESPACE_TABLE, XML_TARGET_CELL_ADDRESS, XML_TOK_CONSOLIDATION_ATTR_TARGET_ADDRESS },
1607 { XML_NAMESPACE_TABLE, XML_USE_LABEL, XML_TOK_CONSOLIDATION_ATTR_USE_LABEL },
1608 { XML_NAMESPACE_TABLE, XML_LINK_TO_SOURCE_DATA, XML_TOK_CONSOLIDATION_ATTR_LINK_TO_SOURCE },
1609 XML_TOKEN_MAP_END
1612 pConsolidationAttrTokenMap = new SvXMLTokenMap( aConsolidationAttrTokenMap );
1613 } // if( !pConsolidationAttrTokenMap )
1615 return *pConsolidationAttrTokenMap;
1619 SvXMLImportContext *ScXMLImport::CreateContext( USHORT nPrefix,
1620 const OUString& rLocalName,
1621 const uno::Reference<xml::sax::XAttributeList>& xAttrList )
1623 SvXMLImportContext *pContext = 0;
1625 if( (XML_NAMESPACE_OFFICE == nPrefix) &&
1626 ( IsXMLToken(rLocalName, XML_DOCUMENT_STYLES) ||
1627 IsXMLToken(rLocalName, XML_DOCUMENT_CONTENT) ||
1628 IsXMLToken(rLocalName, XML_DOCUMENT_SETTINGS) )) {
1629 pContext = new ScXMLDocContext_Impl( *this, nPrefix, rLocalName,
1630 xAttrList );
1631 } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
1632 ( IsXMLToken(rLocalName, XML_DOCUMENT_META)) ) {
1633 pContext = CreateMetaContext(rLocalName);
1634 } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
1635 ( IsXMLToken(rLocalName, XML_DOCUMENT)) ) {
1636 uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
1637 mxServiceFactory->createInstance(::rtl::OUString::createFromAscii(
1638 "com.sun.star.xml.dom.SAXDocumentBuilder")),
1639 uno::UNO_QUERY_THROW);
1640 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1641 GetModel(), uno::UNO_QUERY_THROW);
1642 // flat OpenDocument file format
1643 pContext = new ScXMLFlatDocContext_Impl( *this, nPrefix, rLocalName,
1644 xAttrList, xDPS->getDocumentProperties(), xDocBuilder);
1646 else
1647 pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
1649 return pContext;
1652 // #110680#
1653 ScXMLImport::ScXMLImport(
1654 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
1655 const sal_uInt16 nImportFlag)
1656 : SvXMLImport( xServiceFactory, nImportFlag ),
1657 pDoc( NULL ),
1658 pChangeTrackingImportHelper(NULL),
1659 pStylesImportHelper(NULL),
1660 sNumberFormat(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_NUMFMT)),
1661 sLocale(RTL_CONSTASCII_USTRINGPARAM(SC_LOCALE)),
1662 sCellStyle(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLSTYL)),
1663 sStandardFormat(RTL_CONSTASCII_USTRINGPARAM(SC_STANDARDFORMAT)),
1664 sType(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_TYPE)),
1665 // pScAutoStylePool(new SvXMLAutoStylePoolP),
1666 // pParaItemMapper( 0 ),
1667 // pI18NMap( new SvI18NMap ),
1668 pDocElemTokenMap( 0 ),
1669 pStylesElemTokenMap( 0 ),
1670 pStylesAttrTokenMap( 0 ),
1671 pStyleElemTokenMap( 0 ),
1672 pBodyElemTokenMap( 0 ),
1673 pContentValidationsElemTokenMap( 0 ),
1674 pContentValidationElemTokenMap( 0 ),
1675 pContentValidationAttrTokenMap( 0 ),
1676 pContentValidationMessageElemTokenMap( 0 ),
1677 pContentValidationHelpMessageAttrTokenMap( 0 ),
1678 pContentValidationErrorMessageAttrTokenMap( 0 ),
1679 pContentValidationErrorMacroAttrTokenMap( 0 ),
1680 pLabelRangesElemTokenMap( 0 ),
1681 pLabelRangeAttrTokenMap( 0 ),
1682 pTableElemTokenMap( 0 ),
1683 pTableProtectionElemTokenMap(NULL),
1684 pTableRowsElemTokenMap( 0 ),
1685 pTableColsElemTokenMap( 0 ),
1686 pTableScenarioAttrTokenMap( 0 ),
1687 pTableAttrTokenMap( 0 ),
1688 pTableColAttrTokenMap( 0 ),
1689 pTableRowElemTokenMap( 0 ),
1690 pTableRowAttrTokenMap( 0 ),
1691 pTableRowCellElemTokenMap( 0 ),
1692 pTableRowCellAttrTokenMap( 0 ),
1693 pTableAnnotationAttrTokenMap( 0 ),
1694 pDetectiveElemTokenMap( 0 ),
1695 pDetectiveHighlightedAttrTokenMap( 0 ),
1696 pDetectiveOperationAttrTokenMap( 0 ),
1697 pTableCellRangeSourceAttrTokenMap( 0 ),
1698 pNamedExpressionsElemTokenMap( 0 ),
1699 pNamedRangeAttrTokenMap( 0 ),
1700 pNamedExpressionAttrTokenMap( 0 ),
1701 pDatabaseRangesElemTokenMap( 0 ),
1702 pDatabaseRangeElemTokenMap( 0 ),
1703 pDatabaseRangeAttrTokenMap( 0 ),
1704 pDatabaseRangeSourceSQLAttrTokenMap( 0 ),
1705 pDatabaseRangeSourceTableAttrTokenMap( 0 ),
1706 pDatabaseRangeSourceQueryAttrTokenMap( 0 ),
1707 pFilterElemTokenMap( 0 ),
1708 pFilterAttrTokenMap( 0 ),
1709 pFilterConditionAttrTokenMap( 0 ),
1710 pSortElemTokenMap( 0 ),
1711 pSortAttrTokenMap( 0 ),
1712 pSortSortByAttrTokenMap( 0 ),
1713 pDatabaseRangeSubTotalRulesElemTokenMap( 0 ),
1714 pDatabaseRangeSubTotalRulesAttrTokenMap( 0 ),
1715 pSubTotalRulesSortGroupsAttrTokenMap( 0 ),
1716 pSubTotalRulesSubTotalRuleElemTokenMap( 0 ),
1717 pSubTotalRulesSubTotalRuleAttrTokenMap( 0 ),
1718 pSubTotalRuleSubTotalFieldAttrTokenMap( 0 ),
1719 pDataPilotTablesElemTokenMap( 0 ),
1720 pDataPilotTableAttrTokenMap( 0 ),
1721 pDataPilotTableElemTokenMap( 0 ),
1722 pDataPilotTableSourceServiceAttrTokenMap( 0 ),
1723 pDataPilotGrandTotalAttrTokenMap(NULL),
1724 pDataPilotTableSourceCellRangeElemTokenMap( 0 ),
1725 pDataPilotTableSourceCellRangeAttrTokenMap( 0 ),
1726 pDataPilotFieldAttrTokenMap( 0 ),
1727 pDataPilotFieldElemTokenMap( 0 ),
1728 pDataPilotLevelAttrTokenMap( 0 ),
1729 pDataPilotLevelElemTokenMap( 0 ),
1730 pDataPilotSubTotalsElemTokenMap( 0 ),
1731 pDataPilotSubTotalAttrTokenMap( 0 ),
1732 pDataPilotMembersElemTokenMap( 0 ),
1733 pDataPilotMemberAttrTokenMap( 0 ),
1734 pConsolidationAttrTokenMap( 0 ),
1735 aTables(*this),
1736 pMyNamedExpressions(NULL),
1737 pMyLabelRanges(NULL),
1738 pValidations(NULL),
1739 pDetectiveOpArray(NULL),
1740 pScUnoGuard(NULL),
1741 pNumberFormatAttributesExportHelper(NULL),
1742 pStyleNumberFormats(NULL),
1743 sPrevStyleName(),
1744 sPrevCurrency(),
1745 nSolarMutexLocked(0),
1746 nProgressCount(0),
1747 nStyleFamilyMask( 0 ),
1748 nPrevCellType(0),
1749 bLoadDoc( sal_True ),
1750 bRemoveLastChar(sal_False),
1751 bNullDateSetted(sal_False),
1752 bSelfImportingXMLSet(sal_False),
1753 bLatinDefaultStyle(sal_False),
1754 bFromWrapper(sal_False)
1756 pStylesImportHelper = new ScMyStylesImportHelper(*this);
1758 xScPropHdlFactory = new XMLScPropHdlFactory;
1759 xCellStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScCellStylesProperties, xScPropHdlFactory);
1760 xColumnStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScColumnStylesProperties, xScPropHdlFactory);
1761 xRowStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScRowStylesImportProperties, xScPropHdlFactory);
1762 xTableStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScTableStylesImportProperties, xScPropHdlFactory);
1764 // #i66550# needed for 'presentation:event-listener' element for URLs in shapes
1765 GetNamespaceMap().Add(
1766 GetXMLToken( XML_NP_PRESENTATION ),
1767 GetXMLToken( XML_N_PRESENTATION ),
1768 XML_NAMESPACE_PRESENTATION );
1770 // initialize cell type map.
1771 const struct { XMLTokenEnum _token; sal_Int16 _type; } aCellTypePairs[] =
1773 { XML_FLOAT, util::NumberFormat::NUMBER },
1774 { XML_STRING, util::NumberFormat::TEXT },
1775 { XML_TIME, util::NumberFormat::TIME },
1776 { XML_DATE, util::NumberFormat::DATETIME },
1777 { XML_PERCENTAGE, util::NumberFormat::PERCENT },
1778 { XML_CURRENCY, util::NumberFormat::CURRENCY },
1779 { XML_BOOLEAN, util::NumberFormat::LOGICAL }
1781 size_t n = sizeof(aCellTypePairs)/sizeof(aCellTypePairs[0]);
1782 for (size_t i = 0; i < n; ++i)
1784 aCellTypeMap.insert(
1785 CellTypeMap::value_type(
1786 GetXMLToken(aCellTypePairs[i]._token), aCellTypePairs[i]._type));
1790 ScXMLImport::~ScXMLImport() throw()
1792 // delete pI18NMap;
1793 delete pDocElemTokenMap;
1794 delete pStylesElemTokenMap;
1795 delete pStylesAttrTokenMap;
1796 delete pStyleElemTokenMap;
1797 delete pBodyElemTokenMap;
1798 delete pContentValidationsElemTokenMap;
1799 delete pContentValidationElemTokenMap;
1800 delete pContentValidationAttrTokenMap;
1801 delete pContentValidationMessageElemTokenMap;
1802 delete pContentValidationHelpMessageAttrTokenMap;
1803 delete pContentValidationErrorMessageAttrTokenMap;
1804 delete pContentValidationErrorMacroAttrTokenMap;
1805 delete pLabelRangesElemTokenMap;
1806 delete pLabelRangeAttrTokenMap;
1807 delete pTableElemTokenMap;
1808 delete pTableProtectionElemTokenMap;
1809 delete pTableRowsElemTokenMap;
1810 delete pTableColsElemTokenMap;
1811 delete pTableAttrTokenMap;
1812 delete pTableScenarioAttrTokenMap;
1813 delete pTableColAttrTokenMap;
1814 delete pTableRowElemTokenMap;
1815 delete pTableRowAttrTokenMap;
1816 delete pTableRowCellElemTokenMap;
1817 delete pTableRowCellAttrTokenMap;
1818 delete pTableAnnotationAttrTokenMap;
1819 delete pDetectiveElemTokenMap;
1820 delete pDetectiveHighlightedAttrTokenMap;
1821 delete pDetectiveOperationAttrTokenMap;
1822 delete pTableCellRangeSourceAttrTokenMap;
1823 delete pNamedExpressionsElemTokenMap;
1824 delete pNamedRangeAttrTokenMap;
1825 delete pNamedExpressionAttrTokenMap;
1826 delete pDatabaseRangesElemTokenMap;
1827 delete pDatabaseRangeElemTokenMap;
1828 delete pDatabaseRangeAttrTokenMap;
1829 delete pDatabaseRangeSourceSQLAttrTokenMap;
1830 delete pDatabaseRangeSourceTableAttrTokenMap;
1831 delete pDatabaseRangeSourceQueryAttrTokenMap;
1832 delete pFilterElemTokenMap;
1833 delete pFilterAttrTokenMap;
1834 delete pFilterConditionAttrTokenMap;
1835 delete pSortElemTokenMap;
1836 delete pSortAttrTokenMap;
1837 delete pSortSortByAttrTokenMap;
1838 delete pDatabaseRangeSubTotalRulesElemTokenMap;
1839 delete pDatabaseRangeSubTotalRulesAttrTokenMap;
1840 delete pSubTotalRulesSortGroupsAttrTokenMap;
1841 delete pSubTotalRulesSubTotalRuleElemTokenMap;
1842 delete pSubTotalRulesSubTotalRuleAttrTokenMap;
1843 delete pSubTotalRuleSubTotalFieldAttrTokenMap;
1844 delete pDataPilotTablesElemTokenMap;
1845 delete pDataPilotTableAttrTokenMap;
1846 delete pDataPilotTableElemTokenMap;
1847 delete pDataPilotTableSourceServiceAttrTokenMap;
1848 delete pDataPilotTableSourceCellRangeAttrTokenMap;
1849 delete pDataPilotTableSourceCellRangeElemTokenMap;
1850 delete pDataPilotFieldAttrTokenMap;
1851 delete pDataPilotFieldElemTokenMap;
1852 delete pDataPilotLevelAttrTokenMap;
1853 delete pDataPilotLevelElemTokenMap;
1854 delete pDataPilotSubTotalsElemTokenMap;
1855 delete pDataPilotSubTotalAttrTokenMap;
1856 delete pDataPilotMembersElemTokenMap;
1857 delete pDataPilotMemberAttrTokenMap;
1858 delete pConsolidationAttrTokenMap;
1860 // if (pScAutoStylePool)
1861 // delete pScAutoStylePool;
1862 if (pChangeTrackingImportHelper)
1863 delete pChangeTrackingImportHelper;
1864 if (pNumberFormatAttributesExportHelper)
1865 delete pNumberFormatAttributesExportHelper;
1866 if (pStyleNumberFormats)
1867 delete pStyleNumberFormats;
1868 if (pStylesImportHelper)
1869 delete pStylesImportHelper;
1871 if (pScUnoGuard)
1872 delete pScUnoGuard;
1874 if (pMyNamedExpressions)
1875 delete pMyNamedExpressions;
1876 if (pMyLabelRanges)
1877 delete pMyLabelRanges;
1878 if (pValidations)
1879 delete pValidations;
1880 if (pDetectiveOpArray)
1881 delete pDetectiveOpArray;
1884 // ---------------------------------------------------------------------
1886 SvXMLImportContext *ScXMLImport::CreateFontDeclsContext(const USHORT nPrefix, const ::rtl::OUString& rLocalName,
1887 const uno::Reference<xml::sax::XAttributeList>& xAttrList)
1889 SvXMLImportContext *pContext = NULL;
1890 if (!pContext)
1892 XMLFontStylesContext *pFSContext(
1893 new XMLFontStylesContext( *this, nPrefix,
1894 rLocalName, xAttrList,
1895 gsl_getSystemTextEncoding() ));
1896 SetFontDecls( pFSContext );
1897 pContext = pFSContext;
1899 return pContext;
1902 SvXMLImportContext *ScXMLImport::CreateStylesContext(const ::rtl::OUString& rLocalName,
1903 const uno::Reference<xml::sax::XAttributeList>& xAttrList, sal_Bool bIsAutoStyle )
1905 SvXMLImportContext *pContext(NULL);
1906 if (!pContext)
1908 pContext = new XMLTableStylesContext(*this, XML_NAMESPACE_OFFICE, rLocalName, xAttrList, bIsAutoStyle);
1909 if (bIsAutoStyle)
1910 //xAutoStyles = pContext;
1911 SetAutoStyles((SvXMLStylesContext*)pContext);
1912 else
1913 //xStyles = pContext;
1914 SetStyles((SvXMLStylesContext*)pContext);
1916 return pContext;
1919 SvXMLImportContext *ScXMLImport::CreateBodyContext(const ::rtl::OUString& rLocalName,
1920 const uno::Reference<xml::sax::XAttributeList>& xAttrList)
1922 //GetShapeImport()->SetAutoStylesContext((XMLTableStylesContext *)&xAutoStyles);
1923 //GetChartImport()->SetAutoStylesContext(GetAutoStyles()/*(XMLTableStylesContext *)&xAutoStyles*/);
1925 return new ScXMLBodyContext(*this, XML_NAMESPACE_OFFICE, rLocalName, xAttrList);
1928 SvXMLImportContext *ScXMLImport::CreateMetaContext(
1929 const OUString& rLocalName )
1931 SvXMLImportContext *pContext(0);
1933 if( !IsStylesOnlyMode() && (getImportFlags() & IMPORT_META))
1935 uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
1936 mxServiceFactory->createInstance(::rtl::OUString::createFromAscii(
1937 "com.sun.star.xml.dom.SAXDocumentBuilder")),
1938 uno::UNO_QUERY_THROW);
1939 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1940 GetModel(), uno::UNO_QUERY_THROW);
1941 pContext = new SvXMLMetaDocumentContext(*this,
1942 XML_NAMESPACE_OFFICE, rLocalName,
1943 xDPS->getDocumentProperties(), xDocBuilder);
1946 if( !pContext )
1947 pContext = new SvXMLImportContext( *this,
1948 XML_NAMESPACE_OFFICE, rLocalName );
1950 return pContext;
1953 SvXMLImportContext *ScXMLImport::CreateScriptContext(
1954 const OUString& rLocalName )
1956 SvXMLImportContext *pContext(0);
1958 if( !(IsStylesOnlyMode()) )
1960 pContext = new XMLScriptContext( *this,
1961 XML_NAMESPACE_OFFICE, rLocalName,
1962 GetModel() );
1965 if( !pContext )
1966 pContext = new SvXMLImportContext( *this, XML_NAMESPACE_OFFICE,
1967 rLocalName );
1969 return pContext;
1972 void ScXMLImport::SetStatistics(
1973 const uno::Sequence<beans::NamedValue> & i_rStats)
1975 static const char* s_stats[] =
1976 { "TableCount", "CellCount", "ObjectCount", 0 };
1978 SvXMLImport::SetStatistics(i_rStats);
1980 sal_uInt32 nCount(0);
1981 for (sal_Int32 i = 0; i < i_rStats.getLength(); ++i) {
1982 for (const char** pStat = s_stats; *pStat != 0; ++pStat) {
1983 if (i_rStats[i].Name.equalsAscii(*pStat)) {
1984 sal_Int32 val = 0;
1985 if (i_rStats[i].Value >>= val) {
1986 nCount += val;
1987 } else {
1988 DBG_ERROR("ScXMLImport::SetStatistics: invalid entry");
1994 if (nCount)
1996 GetProgressBarHelper()->SetReference(nCount);
1997 GetProgressBarHelper()->SetValue(0);
2001 sal_Int16 ScXMLImport::GetCellType(const OUString& rStrValue) const
2003 CellTypeMap::const_iterator itr = aCellTypeMap.find(rStrValue);
2004 if (itr != aCellTypeMap.end())
2005 return itr->second;
2007 return util::NumberFormat::UNDEFINED;
2010 XMLShapeImportHelper* ScXMLImport::CreateShapeImport()
2012 /*UniReference < XMLPropertySetMapper > xShapeStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScShapeStylesProperties, xScPropHdlFactory);
2013 SvXMLImportPropertyMapper *pShapeStylesImportPropertySetMapper = new SvXMLImportPropertyMapper( xShapeStylesPropertySetMapper );*/
2015 return new XMLTableShapeImportHelper( *this/*, pShapeStylesImportPropertySetMapper*/ );
2018 sal_Bool ScXMLImport::GetValidation(const rtl::OUString& sName, ScMyImportValidation& aValidation)
2020 if (pValidations)
2022 sal_Bool bFound(sal_False);
2023 ScMyImportValidations::iterator aItr(pValidations->begin());
2024 ScMyImportValidations::iterator aEndItr(pValidations->end());
2025 while(aItr != aEndItr && !bFound)
2027 if (aItr->sName == sName)
2029 // #b4974740# source position must be set as string,
2030 // so sBaseCellAddress no longer has to be converted here
2032 bFound = sal_True;
2034 else
2035 ++aItr;
2037 if (bFound)
2038 aValidation = *aItr;
2039 return bFound;
2041 return sal_False;
2044 ScXMLChangeTrackingImportHelper* ScXMLImport::GetChangeTrackingImportHelper()
2046 if (!pChangeTrackingImportHelper)
2047 pChangeTrackingImportHelper = new ScXMLChangeTrackingImportHelper();
2048 return pChangeTrackingImportHelper;
2051 void ScXMLImport::InsertStyles()
2053 GetStyles()->CopyStylesToDoc(sal_True);
2055 // if content is going to be loaded with the same import, set bLatinDefaultStyle flag now
2056 if ( getImportFlags() & IMPORT_CONTENT )
2057 ExamineDefaultStyle();
2060 void ScXMLImport::ExamineDefaultStyle()
2062 if (pDoc)
2064 // #i62435# after inserting the styles, check if the default style has a latin-script-only
2065 // number format (then, value cells can be pre-initialized with western script type)
2067 const ScPatternAttr* pDefPattern = pDoc->GetDefPattern();
2068 SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
2069 if ( pFormatter && pDefPattern )
2071 sal_uInt32 nKey = pDefPattern->GetNumberFormat(pFormatter);
2072 const SvNumberformat* pFormat = pFormatter->GetEntry(nKey);
2073 if ( pFormat && pFormat->IsStandard() )
2075 // The standard format is all-latin if the decimal separator dosen't
2076 // have a different script type
2078 String aDecSep;
2079 LanguageType nFormatLang = pFormat->GetLanguage();
2080 if ( nFormatLang == LANGUAGE_SYSTEM )
2081 aDecSep = ScGlobal::pLocaleData->getNumDecimalSep();
2082 else
2084 LocaleDataWrapper aLocaleData( pDoc->GetServiceManager(),
2085 MsLangId::convertLanguageToLocale( nFormatLang ) );
2086 aDecSep = aLocaleData.getNumDecimalSep();
2089 BYTE nScript = pDoc->GetStringScriptType( aDecSep );
2090 if ( nScript == 0 || nScript == SCRIPTTYPE_LATIN )
2091 bLatinDefaultStyle = sal_True;
2097 void ScXMLImport::SetChangeTrackingViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rChangeProps)
2099 if (pDoc)
2101 sal_Int32 nCount(rChangeProps.getLength());
2102 if (nCount)
2104 LockSolarMutex();
2105 sal_Int16 nTemp16(0);
2106 ScChangeViewSettings* pViewSettings(new ScChangeViewSettings());
2107 for (sal_Int32 i = 0; i < nCount; ++i)
2109 rtl::OUString sName(rChangeProps[i].Name);
2110 if (sName.compareToAscii("ShowChanges") == 0)
2111 pViewSettings->SetShowChanges(::cppu::any2bool(rChangeProps[i].Value));
2112 else if (sName.compareToAscii("ShowAcceptedChanges") == 0)
2113 pViewSettings->SetShowAccepted(::cppu::any2bool(rChangeProps[i].Value));
2114 else if (sName.compareToAscii("ShowRejectedChanges") == 0)
2115 pViewSettings->SetShowRejected(::cppu::any2bool(rChangeProps[i].Value));
2116 else if (sName.compareToAscii("ShowChangesByDatetime") == 0)
2117 pViewSettings->SetHasDate(::cppu::any2bool(rChangeProps[i].Value));
2118 else if (sName.compareToAscii("ShowChangesByDatetimeMode") == 0)
2120 if (rChangeProps[i].Value >>= nTemp16)
2121 pViewSettings->SetTheDateMode(ScChgsDateMode(nTemp16));
2123 else if (sName.compareToAscii("ShowChangesByDatetimeFirstDatetime") == 0)
2125 util::DateTime aDateTime;
2126 if (rChangeProps[i].Value >>= aDateTime)
2128 DateTime aCoreDateTime;
2129 ScXMLConverter::ConvertAPIToCoreDateTime(aDateTime, aCoreDateTime);
2130 pViewSettings->SetTheFirstDateTime(aCoreDateTime);
2133 else if (sName.compareToAscii("ShowChangesByDatetimeSecondDatetime") == 0)
2135 util::DateTime aDateTime;
2136 if (rChangeProps[i].Value >>= aDateTime)
2138 DateTime aCoreDateTime;
2139 ScXMLConverter::ConvertAPIToCoreDateTime(aDateTime, aCoreDateTime);
2140 pViewSettings->SetTheLastDateTime(aCoreDateTime);
2143 else if (sName.compareToAscii("ShowChangesByAuthor") == 0)
2144 pViewSettings->SetHasAuthor(::cppu::any2bool(rChangeProps[i].Value));
2145 else if (sName.compareToAscii("ShowChangesByAuthorName") == 0)
2147 rtl::OUString sOUName;
2148 if (rChangeProps[i].Value >>= sOUName)
2150 String sAuthorName(sOUName);
2151 pViewSettings->SetTheAuthorToShow(sAuthorName);
2154 else if (sName.compareToAscii("ShowChangesByComment") == 0)
2155 pViewSettings->SetHasComment(::cppu::any2bool(rChangeProps[i].Value));
2156 else if (sName.compareToAscii("ShowChangesByCommentText") == 0)
2158 rtl::OUString sOUComment;
2159 if (rChangeProps[i].Value >>= sOUComment)
2161 String sComment(sOUComment);
2162 pViewSettings->SetTheComment(sComment);
2165 else if (sName.compareToAscii("ShowChangesByRanges") == 0)
2166 pViewSettings->SetHasRange(::cppu::any2bool(rChangeProps[i].Value));
2167 else if (sName.compareToAscii("ShowChangesByRangesList") == 0)
2169 rtl::OUString sRanges;
2170 if ((rChangeProps[i].Value >>= sRanges) && sRanges.getLength())
2172 ScRangeList aRangeList;
2173 ScRangeStringConverter::GetRangeListFromString(
2174 aRangeList, sRanges, GetDocument(), FormulaGrammar::CONV_OOO);
2175 pViewSettings->SetTheRangeList(aRangeList);
2179 pDoc->SetChangeViewSettings(*pViewSettings);
2180 UnlockSolarMutex();
2185 void ScXMLImport::SetViewSettings(const uno::Sequence<beans::PropertyValue>& aViewProps)
2187 sal_Int32 nCount(aViewProps.getLength());
2188 sal_Int32 nHeight(0);
2189 sal_Int32 nLeft(0);
2190 sal_Int32 nTop(0);
2191 sal_Int32 nWidth(0);
2192 for (sal_Int32 i = 0; i < nCount; ++i)
2194 rtl::OUString sName(aViewProps[i].Name);
2195 if (sName.compareToAscii("VisibleAreaHeight") == 0)
2196 aViewProps[i].Value >>= nHeight;
2197 else if (sName.compareToAscii("VisibleAreaLeft") == 0)
2198 aViewProps[i].Value >>= nLeft;
2199 else if (sName.compareToAscii("VisibleAreaTop") == 0)
2200 aViewProps[i].Value >>= nTop;
2201 else if (sName.compareToAscii("VisibleAreaWidth") == 0)
2202 aViewProps[i].Value >>= nWidth;
2203 else if (sName.compareToAscii("TrackedChangesViewSettings") == 0)
2205 uno::Sequence<beans::PropertyValue> aChangeProps;
2206 if(aViewProps[i].Value >>= aChangeProps)
2207 SetChangeTrackingViewSettings(aChangeProps);
2210 if (nHeight && nWidth)
2212 if (GetModel().is())
2214 ScModelObj* pDocObj(ScModelObj::getImplementation( GetModel() ));
2215 if (pDocObj)
2217 SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject();
2218 if (pEmbeddedObj)
2220 Rectangle aRect;
2221 aRect.setX( nLeft );
2222 aRect.setY( nTop );
2223 aRect.setWidth( nWidth );
2224 aRect.setHeight( nHeight );
2225 pEmbeddedObj->SetVisArea(aRect);
2232 void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyValue>& aConfigProps)
2234 if (GetModel().is())
2236 uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
2237 if (xMultiServiceFactory.is())
2239 sal_Int32 nCount(aConfigProps.getLength());
2240 rtl::OUString sName(RTL_CONSTASCII_USTRINGPARAM("TrackedChangesProtectionKey"));
2241 for (sal_Int32 i = nCount - 1; i >= 0; --i)
2243 if (aConfigProps[i].Name == sName)
2245 rtl::OUString sKey;
2246 if (aConfigProps[i].Value >>= sKey)
2248 uno::Sequence<sal_Int8> aPass;
2249 SvXMLUnitConverter::decodeBase64(aPass, sKey);
2250 if (aPass.getLength())
2252 if (pDoc->GetChangeTrack())
2253 pDoc->GetChangeTrack()->SetProtection(aPass);
2254 else
2256 ScStrCollection aUsers;
2257 ScChangeTrack* pTrack = new ScChangeTrack(pDoc, aUsers);
2258 pTrack->SetProtection(aPass);
2259 pDoc->SetChangeTrack(pTrack);
2265 uno::Reference <uno::XInterface> xInterface = xMultiServiceFactory->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.SpreadsheetSettings")));
2266 uno::Reference <beans::XPropertySet> xProperties(xInterface, uno::UNO_QUERY);
2267 if (xProperties.is())
2268 SvXMLUnitConverter::convertPropertySet(xProperties, aConfigProps);
2273 sal_Int32 ScXMLImport::SetCurrencySymbol(const sal_Int32 nKey, const rtl::OUString& rCurrency)
2275 uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
2276 if (xNumberFormatsSupplier.is())
2278 uno::Reference <util::XNumberFormats> xLocalNumberFormats(xNumberFormatsSupplier->getNumberFormats());
2279 if (xLocalNumberFormats.is())
2281 rtl::OUString sFormatString;
2284 uno::Reference <beans::XPropertySet> xProperties(xLocalNumberFormats->getByKey(nKey));
2285 if (xProperties.is())
2287 lang::Locale aLocale;
2288 if (GetDocument() && (xProperties->getPropertyValue(sLocale) >>= aLocale))
2290 LockSolarMutex();
2291 LocaleDataWrapper aLocaleData( GetDocument()->GetServiceManager(), aLocale );
2292 rtl::OUStringBuffer aBuffer(15);
2293 aBuffer.appendAscii("#");
2294 aBuffer.append( aLocaleData.getNumThousandSep() );
2295 aBuffer.appendAscii("##0");
2296 aBuffer.append( aLocaleData.getNumDecimalSep() );
2297 aBuffer.appendAscii("00 [$");
2298 aBuffer.append(rCurrency);
2299 aBuffer.appendAscii("]");
2300 UnlockSolarMutex();
2301 sFormatString = aBuffer.makeStringAndClear();
2302 sal_Int32 nNewKey = xLocalNumberFormats->queryKey(sFormatString, aLocale, sal_True);
2303 if (nNewKey == -1)
2304 nNewKey = xLocalNumberFormats->addNew(sFormatString, aLocale);
2305 return nNewKey;
2309 catch ( util::MalformedNumberFormatException& rException )
2311 rtl::OUString sErrorMessage(RTL_CONSTASCII_USTRINGPARAM("Fehler im Formatstring "));
2312 sErrorMessage += sFormatString;
2313 sErrorMessage += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" an Position "));
2314 sErrorMessage += rtl::OUString::valueOf(rException.CheckPos);
2315 uno::Sequence<rtl::OUString> aSeq(1);
2316 aSeq[0] = sErrorMessage;
2317 uno::Reference<xml::sax::XLocator> xLocator;
2318 SetError(XMLERROR_API | XMLERROR_FLAG_ERROR, aSeq, rException.Message, xLocator);
2322 return nKey;
2325 sal_Bool ScXMLImport::IsCurrencySymbol(const sal_Int32 nNumberFormat, const rtl::OUString& sCurrentCurrency, const rtl::OUString& sBankSymbol)
2327 uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
2328 if (xNumberFormatsSupplier.is())
2330 uno::Reference <util::XNumberFormats> xLocalNumberFormats(xNumberFormatsSupplier->getNumberFormats());
2331 if (xLocalNumberFormats.is())
2335 uno::Reference <beans::XPropertySet> xNumberPropertySet(xLocalNumberFormats->getByKey(nNumberFormat));
2336 if (xNumberPropertySet.is())
2338 rtl::OUString sTemp;
2339 if ( xNumberPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_CURRENCYSYMBOL))) >>= sTemp)
2341 if (sCurrentCurrency.equals(sTemp))
2342 return sal_True;
2343 // #i61657# This may be a legacy currency symbol that changed in the meantime.
2344 if (SvNumberFormatter::GetLegacyOnlyCurrencyEntry( sCurrentCurrency, sBankSymbol) != NULL)
2345 return true;
2346 // In the rare case that sCurrentCurrency is not the
2347 // currency symbol, but a matching ISO code
2348 // abbreviation instead that was obtained through
2349 // XMLNumberFormatAttributesExportHelper::GetCellType(),
2350 // check with the number format's symbol. This happens,
2351 // for example, in the es_BO locale, where a legacy
2352 // B$,BOB matched B$->BOP, which leads to
2353 // sCurrentCurrency being BOP, and the previous call
2354 // with BOP,BOB didn't find an entry, but B$,BOB will.
2355 return SvNumberFormatter::GetLegacyOnlyCurrencyEntry( sTemp, sBankSymbol) != NULL;
2359 catch ( uno::Exception& )
2361 DBG_ERROR("Numberformat not found");
2365 return sal_False;
2368 void ScXMLImport::SetType(uno::Reference <beans::XPropertySet>& rProperties,
2369 sal_Int32& rNumberFormat,
2370 const sal_Int16 nCellType,
2371 const rtl::OUString& rCurrency)
2373 if ((nCellType != util::NumberFormat::TEXT) && (nCellType != util::NumberFormat::UNDEFINED))
2375 if (rNumberFormat == -1)
2376 rProperties->getPropertyValue( sNumberFormat ) >>= rNumberFormat;
2377 DBG_ASSERT(rNumberFormat != -1, "no NumberFormat");
2378 sal_Bool bIsStandard;
2379 // sCurrentCurrency may be the ISO code abbreviation if the currency
2380 // symbol matches such, or if no match found the symbol itself!
2381 rtl::OUString sCurrentCurrency;
2382 sal_Int32 nCurrentCellType(
2383 GetNumberFormatAttributesExportHelper()->GetCellType(
2384 rNumberFormat, sCurrentCurrency, bIsStandard) & ~util::NumberFormat::DEFINED);
2385 if ((nCellType != nCurrentCellType) && !((nCellType == util::NumberFormat::NUMBER &&
2386 ((nCurrentCellType == util::NumberFormat::SCIENTIFIC) ||
2387 (nCurrentCellType == util::NumberFormat::FRACTION) ||
2388 (nCurrentCellType == util::NumberFormat::LOGICAL) ||
2389 (nCurrentCellType == 0))) || (nCurrentCellType == util::NumberFormat::TEXT)) && !((nCellType == util::NumberFormat::DATETIME) &&
2390 (nCurrentCellType == util::NumberFormat::DATE)))
2392 if (!xNumberFormats.is())
2394 uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
2395 if (xNumberFormatsSupplier.is())
2396 xNumberFormats.set(xNumberFormatsSupplier->getNumberFormats());
2398 if (xNumberFormats.is())
2402 uno::Reference < beans::XPropertySet> xNumberFormatProperties(xNumberFormats->getByKey(rNumberFormat));
2403 if (xNumberFormatProperties.is())
2405 if (nCellType != util::NumberFormat::CURRENCY)
2407 lang::Locale aLocale;
2408 if ( xNumberFormatProperties->getPropertyValue(sLocale) >>= aLocale )
2410 if (!xNumberFormatTypes.is())
2411 xNumberFormatTypes.set(uno::Reference <util::XNumberFormatTypes>(xNumberFormats, uno::UNO_QUERY));
2412 rProperties->setPropertyValue( sNumberFormat, uno::makeAny(xNumberFormatTypes->getStandardFormat(nCellType, aLocale)) );
2415 else if (rCurrency.getLength() && sCurrentCurrency.getLength())
2417 if (!sCurrentCurrency.equals(rCurrency))
2418 if (!IsCurrencySymbol(rNumberFormat, sCurrentCurrency, rCurrency))
2419 rProperties->setPropertyValue( sNumberFormat, uno::makeAny(SetCurrencySymbol(rNumberFormat, rCurrency)));
2423 catch ( uno::Exception& )
2425 DBG_ERROR("Numberformat not found");
2429 else
2431 if ((nCellType == util::NumberFormat::CURRENCY) && rCurrency.getLength() && sCurrentCurrency.getLength() &&
2432 !sCurrentCurrency.equals(rCurrency) && !IsCurrencySymbol(rNumberFormat, sCurrentCurrency, rCurrency))
2433 rProperties->setPropertyValue( sNumberFormat, uno::makeAny(SetCurrencySymbol(rNumberFormat, rCurrency)));
2438 void ScXMLImport::AddStyleRange(const table::CellRangeAddress& rCellRange)
2440 if (!xSheetCellRanges.is() && GetModel().is())
2442 uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
2443 if (xMultiServiceFactory.is())
2444 xSheetCellRanges.set(uno::Reference <sheet::XSheetCellRangeContainer>(xMultiServiceFactory->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SheetCellRanges"))), uno::UNO_QUERY));
2445 DBG_ASSERT(xSheetCellRanges.is(), "didn't get SheetCellRanges");
2448 xSheetCellRanges->addRangeAddress(rCellRange, sal_False);
2451 void ScXMLImport::SetStyleToRanges()
2453 if (sPrevStyleName.getLength())
2455 uno::Reference <beans::XPropertySet> xProperties (xSheetCellRanges, uno::UNO_QUERY);
2456 if (xProperties.is())
2458 XMLTableStylesContext *pStyles((XMLTableStylesContext *)GetAutoStyles());
2459 XMLTableStyleContext* pStyle( pStyles ? (XMLTableStyleContext *)pStyles->FindStyleChildContext(
2460 XML_STYLE_FAMILY_TABLE_CELL, sPrevStyleName, sal_True) : NULL );
2461 if (pStyle)
2463 pStyle->FillPropertySet(xProperties);
2464 sal_Int32 nNumberFormat(pStyle->GetNumberFormat());
2465 SetType(xProperties, nNumberFormat, nPrevCellType, sPrevCurrency);
2467 // store first cell of first range for each style, once per sheet
2468 uno::Sequence<table::CellRangeAddress> aAddresses(xSheetCellRanges->getRangeAddresses());
2469 if ( aAddresses.getLength() > 0 )
2471 const table::CellRangeAddress& rRange = aAddresses[0];
2472 if ( rRange.Sheet != pStyle->GetLastSheet() )
2474 ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
2475 pSheetData->AddCellStyle( sPrevStyleName,
2476 ScAddress( (SCCOL)rRange.StartColumn, (SCROW)rRange.StartRow, (SCTAB)rRange.Sheet ) );
2477 pStyle->SetLastSheet(rRange.Sheet);
2481 else
2483 xProperties->setPropertyValue(sCellStyle, uno::makeAny(GetStyleDisplayName( XML_STYLE_FAMILY_TABLE_CELL, sPrevStyleName )));
2484 sal_Int32 nNumberFormat(GetStyleNumberFormats()->GetStyleNumberFormat(sPrevStyleName));
2485 sal_Bool bInsert(nNumberFormat == -1);
2486 SetType(xProperties, nNumberFormat, nPrevCellType, sPrevCurrency);
2487 if (bInsert)
2488 GetStyleNumberFormats()->AddStyleNumberFormat(sPrevStyleName, nNumberFormat);
2492 if (GetModel().is())
2494 uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
2495 if (xMultiServiceFactory.is())
2496 xSheetCellRanges.set(uno::Reference <sheet::XSheetCellRangeContainer>(
2497 xMultiServiceFactory->createInstance(
2498 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SheetCellRanges"))),
2499 uno::UNO_QUERY));
2501 DBG_ASSERT(xSheetCellRanges.is(), "didn't get SheetCellRanges");
2504 void ScXMLImport::SetStyleToRange(const ScRange& rRange, const rtl::OUString* pStyleName,
2505 const sal_Int16 nCellType, const rtl::OUString* pCurrency)
2507 if (!sPrevStyleName.getLength())
2509 nPrevCellType = nCellType;
2510 if (pStyleName)
2511 sPrevStyleName = *pStyleName;
2512 if (pCurrency)
2513 sPrevCurrency = *pCurrency;
2514 else if (sPrevCurrency.getLength())
2515 sPrevCurrency = sEmpty;
2517 else if ((nCellType != nPrevCellType) ||
2518 ((pStyleName && !pStyleName->equals(sPrevStyleName)) ||
2519 (!pStyleName && sPrevStyleName.getLength())) ||
2520 ((pCurrency && !pCurrency->equals(sPrevCurrency)) ||
2521 (!pCurrency && sPrevCurrency.getLength())))
2523 SetStyleToRanges();
2524 nPrevCellType = nCellType;
2525 if (pStyleName)
2526 sPrevStyleName = *pStyleName;
2527 else if(sPrevStyleName.getLength())
2528 sPrevStyleName = sEmpty;
2529 if (pCurrency)
2530 sPrevCurrency = *pCurrency;
2531 else if(sPrevCurrency.getLength())
2532 sPrevCurrency = sEmpty;
2534 table::CellRangeAddress aCellRange;
2535 aCellRange.StartColumn = rRange.aStart.Col();
2536 aCellRange.StartRow = rRange.aStart.Row();
2537 aCellRange.Sheet = rRange.aStart.Tab();
2538 aCellRange.EndColumn = rRange.aEnd.Col();
2539 aCellRange.EndRow = rRange.aEnd.Row();
2540 AddStyleRange(aCellRange);
2543 sal_Bool ScXMLImport::SetNullDateOnUnitConverter()
2545 if (!bNullDateSetted)
2546 bNullDateSetted = GetMM100UnitConverter().setNullDate(GetModel());
2547 DBG_ASSERT(bNullDateSetted, "could not set the null date");
2548 return bNullDateSetted;
2551 XMLNumberFormatAttributesExportHelper* ScXMLImport::GetNumberFormatAttributesExportHelper()
2553 if (!pNumberFormatAttributesExportHelper)
2554 pNumberFormatAttributesExportHelper = new XMLNumberFormatAttributesExportHelper(GetNumberFormatsSupplier());
2555 return pNumberFormatAttributesExportHelper;
2558 ScMyStyleNumberFormats* ScXMLImport::GetStyleNumberFormats()
2560 if (!pStyleNumberFormats)
2561 pStyleNumberFormats = new ScMyStyleNumberFormats();
2562 return pStyleNumberFormats;
2565 void ScXMLImport::SetStylesToRangesFinished()
2567 SetStyleToRanges();
2568 sPrevStyleName = sEmpty;
2571 // XImporter
2572 void SAL_CALL ScXMLImport::setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
2573 throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
2575 LockSolarMutex();
2576 SvXMLImport::setTargetDocument( xDoc );
2578 uno::Reference<frame::XModel> xModel(xDoc, uno::UNO_QUERY);
2579 pDoc = ScXMLConverter::GetScDocument( xModel );
2580 DBG_ASSERT( pDoc, "ScXMLImport::setTargetDocument - no ScDocument!" );
2581 if (!pDoc)
2582 throw lang::IllegalArgumentException();
2584 bFromWrapper = pDoc->IsXMLFromWrapper(); // UnlockSolarMutex below still works normally
2586 uno::Reference<document::XActionLockable> xActionLockable(xDoc, uno::UNO_QUERY);
2587 if (xActionLockable.is())
2588 xActionLockable->addActionLock();
2589 UnlockSolarMutex();
2592 // XServiceInfo
2593 ::rtl::OUString SAL_CALL ScXMLImport::getImplementationName( )
2594 throw(::com::sun::star::uno::RuntimeException)
2596 switch( getImportFlags() )
2598 case IMPORT_ALL:
2599 return ScXMLImport_getImplementationName();
2600 case (IMPORT_STYLES|IMPORT_MASTERSTYLES|IMPORT_AUTOSTYLES|IMPORT_FONTDECLS):
2601 return ScXMLImport_Styles_getImplementationName();
2602 case (IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS):
2603 return ScXMLImport_Content_getImplementationName();
2604 case IMPORT_META:
2605 return ScXMLImport_Meta_getImplementationName();
2606 case IMPORT_SETTINGS:
2607 return ScXMLImport_Settings_getImplementationName();
2608 default:
2609 // generic name for 'unknown' cases
2610 return ScXMLImport_getImplementationName();
2612 return SvXMLImport::getImplementationName();
2615 // ::com::sun::star::xml::sax::XDocumentHandler
2616 void SAL_CALL ScXMLImport::startDocument(void)
2617 throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException )
2619 LockSolarMutex();
2620 SvXMLImport::startDocument();
2621 if (pDoc && !pDoc->IsImportingXML())
2623 ScModelObj::getImplementation(GetModel())->BeforeXMLLoading();
2624 bSelfImportingXMLSet = sal_True;
2627 // if content and styles are loaded with separate imports,
2628 // set bLatinDefaultStyle flag at the start of the content import
2629 sal_uInt16 nFlags = getImportFlags();
2630 if ( ( nFlags & IMPORT_CONTENT ) && !( nFlags & IMPORT_STYLES ) )
2631 ExamineDefaultStyle();
2633 if (getImportFlags() & IMPORT_CONTENT)
2635 if (GetModel().is())
2637 // store initial namespaces, to find the ones that were added from the file later
2638 ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
2639 const SvXMLNamespaceMap& rNamespaces = GetNamespaceMap();
2640 pSheetData->StoreInitialNamespaces(rNamespaces);
2644 UnlockSolarMutex();
2647 sal_Int32 ScXMLImport::GetRangeType(const rtl::OUString sRangeType) const
2649 sal_Int32 nRangeType(0);
2650 rtl::OUStringBuffer sBuffer;
2651 sal_Int16 i = 0;
2652 while (i <= sRangeType.getLength())
2654 if ((sRangeType[i] == ' ') || (i == sRangeType.getLength()))
2656 rtl::OUString sTemp = sBuffer.makeStringAndClear();
2657 if (sTemp.compareToAscii(SC_REPEAT_COLUMN) == 0)
2658 nRangeType |= sheet::NamedRangeFlag::COLUMN_HEADER;
2659 else if (sTemp.compareToAscii(SC_REPEAT_ROW) == 0)
2660 nRangeType |= sheet::NamedRangeFlag::ROW_HEADER;
2661 else if (sTemp.compareToAscii(SC_FILTER) == 0)
2662 nRangeType |= sheet::NamedRangeFlag::FILTER_CRITERIA;
2663 else if (sTemp.compareToAscii(SC_PRINT_RANGE) == 0)
2664 nRangeType |= sheet::NamedRangeFlag::PRINT_AREA;
2666 else if (i < sRangeType.getLength())
2667 sBuffer.append(sRangeType[i]);
2668 ++i;
2670 return nRangeType;
2673 void ScXMLImport::SetLabelRanges()
2675 ScMyLabelRanges* pLabelRanges = GetLabelRanges();
2676 if (pLabelRanges)
2678 uno::Reference <beans::XPropertySet> xPropertySet (GetModel(), uno::UNO_QUERY);
2679 if (xPropertySet.is())
2681 uno::Any aColAny = xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_COLLABELRNG)));
2682 uno::Any aRowAny = xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ROWLABELRNG)));
2684 uno::Reference< sheet::XLabelRanges > xColRanges;
2685 uno::Reference< sheet::XLabelRanges > xRowRanges;
2687 if ( ( aColAny >>= xColRanges ) && ( aRowAny >>= xRowRanges ) )
2689 table::CellRangeAddress aLabelRange;
2690 table::CellRangeAddress aDataRange;
2692 ScMyLabelRanges::iterator aItr = pLabelRanges->begin();
2693 while (aItr != pLabelRanges->end())
2695 sal_Int32 nOffset1(0);
2696 sal_Int32 nOffset2(0);
2697 FormulaGrammar::AddressConvention eConv = FormulaGrammar::CONV_OOO;
2699 if (ScRangeStringConverter::GetRangeFromString( aLabelRange, (*aItr)->sLabelRangeStr, GetDocument(), eConv, nOffset1 ) &&
2700 ScRangeStringConverter::GetRangeFromString( aDataRange, (*aItr)->sDataRangeStr, GetDocument(), eConv, nOffset2 ))
2702 if ( (*aItr)->bColumnOrientation )
2703 xColRanges->addNew( aLabelRange, aDataRange );
2704 else
2705 xRowRanges->addNew( aLabelRange, aDataRange );
2708 delete *aItr;
2709 aItr = pLabelRanges->erase(aItr);
2716 void ScXMLImport::SetNamedRanges()
2718 ScMyNamedExpressions* pNamedExpressions(GetNamedExpressions());
2719 if (pNamedExpressions)
2721 uno::Reference <beans::XPropertySet> xPropertySet (GetModel(), uno::UNO_QUERY);
2722 if (xPropertySet.is())
2724 uno::Reference <sheet::XNamedRanges> xNamedRanges(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_NAMEDRANGES))), uno::UNO_QUERY);
2725 if (xNamedRanges.is())
2727 ScMyNamedExpressions::iterator aItr(pNamedExpressions->begin());
2728 ScMyNamedExpressions::const_iterator aEndItr(pNamedExpressions->end());
2729 table::CellAddress aCellAddress;
2730 rtl::OUString sTempContent(RTL_CONSTASCII_USTRINGPARAM("0"));
2731 while (aItr != aEndItr)
2733 sal_Int32 nOffset(0);
2734 if (ScRangeStringConverter::GetAddressFromString(
2735 aCellAddress, (*aItr)->sBaseCellAddress, GetDocument(), FormulaGrammar::CONV_OOO, nOffset ))
2739 xNamedRanges->addNewByName((*aItr)->sName, sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType));
2741 catch( uno::RuntimeException& )
2743 DBG_ERROR("here are some Named Ranges with the same name");
2744 uno::Reference < container::XIndexAccess > xIndex(xNamedRanges, uno::UNO_QUERY);
2745 if (xIndex.is())
2747 sal_Int32 nMax(xIndex->getCount());
2748 sal_Bool bInserted(sal_False);
2749 sal_Int32 nCount(1);
2750 rtl::OUStringBuffer sName((*aItr)->sName);
2751 sName.append(sal_Unicode('_'));
2752 while (!bInserted && nCount <= nMax)
2754 rtl::OUStringBuffer sTemp(sName);
2755 sTemp.append(rtl::OUString::valueOf(nCount));
2758 xNamedRanges->addNewByName(sTemp.makeStringAndClear(), sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType));
2759 bInserted = sal_True;
2761 catch( uno::RuntimeException& )
2763 ++nCount;
2769 ++aItr;
2771 aItr = pNamedExpressions->begin();
2772 while (aItr != aEndItr)
2774 sal_Int32 nOffset(0);
2775 if (ScRangeStringConverter::GetAddressFromString(
2776 aCellAddress, (*aItr)->sBaseCellAddress, GetDocument(), FormulaGrammar::CONV_OOO, nOffset ))
2778 uno::Reference <sheet::XNamedRange> xNamedRange(xNamedRanges->getByName((*aItr)->sName), uno::UNO_QUERY);
2779 if (xNamedRange.is())
2781 LockSolarMutex();
2782 ScNamedRangeObj* pNamedRangeObj = ScNamedRangeObj::getImplementation( xNamedRange);
2783 if (pNamedRangeObj)
2785 sTempContent = (*aItr)->sContent;
2786 // Get rid of leading sheet dots in simple ranges.
2787 if (!(*aItr)->bIsExpression)
2788 ScXMLConverter::ParseFormula( sTempContent, false);
2789 pNamedRangeObj->SetContentWithGrammar( sTempContent, (*aItr)->eGrammar);
2791 UnlockSolarMutex();
2794 delete *aItr;
2795 aItr = pNamedExpressions->erase(aItr);
2802 void SAL_CALL ScXMLImport::endDocument(void)
2803 throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException )
2805 LockSolarMutex();
2806 if (getImportFlags() & IMPORT_CONTENT)
2808 if (GetModel().is())
2810 uno::Reference<document::XViewDataSupplier> xViewDataSupplier(GetModel(), uno::UNO_QUERY);
2811 if (xViewDataSupplier.is())
2813 uno::Reference<container::XIndexAccess> xIndexAccess(xViewDataSupplier->getViewData());
2814 if (xIndexAccess.is() && xIndexAccess->getCount() > 0)
2816 uno::Sequence< beans::PropertyValue > aSeq;
2817 if (xIndexAccess->getByIndex(0) >>= aSeq)
2819 sal_Int32 nCount (aSeq.getLength());
2820 for (sal_Int32 i = 0; i < nCount; ++i)
2822 rtl::OUString sName(aSeq[i].Name);
2823 if (sName.compareToAscii(SC_ACTIVETABLE) == 0)
2825 rtl::OUString sValue;
2826 if(aSeq[i].Value >>= sValue)
2828 String sTabName(sValue);
2829 SCTAB nTab(0);
2830 if (pDoc->GetTable(sTabName, nTab))
2832 pDoc->SetVisibleTab(nTab);
2833 i = nCount;
2841 SetLabelRanges();
2842 SetNamedRanges();
2844 GetProgressBarHelper()->End(); // make room for subsequent SfxProgressBars
2845 if (pDoc)
2846 pDoc->CompileXML();
2848 if (pDoc && GetModel().is())
2850 // set "valid stream" flags after loading (before UpdateRowHeights, so changed formula results
2851 // in UpdateRowHeights can already clear the flags again)
2852 ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
2854 SCTAB nTabCount = pDoc->GetTableCount();
2855 for (SCTAB nTab=0; nTab<nTabCount; ++nTab)
2856 if (!pSheetData->IsSheetBlocked( nTab ))
2857 pDoc->SetStreamValid( nTab, TRUE );
2860 aTables.UpdateRowHeights();
2861 aTables.ResizeShapes();
2863 if (GetModel().is())
2865 uno::Reference<document::XActionLockable> xActionLockable(GetModel(), uno::UNO_QUERY);
2866 if (xActionLockable.is())
2867 xActionLockable->removeActionLock();
2869 SvXMLImport::endDocument();
2871 if (pDoc && bSelfImportingXMLSet)
2873 ScModelObj::getImplementation(GetModel())->AfterXMLLoading(sal_True);
2876 UnlockSolarMutex();
2879 // XEventListener
2880 void ScXMLImport::DisposingModel()
2882 SvXMLImport::DisposingModel();
2883 pDoc = NULL;
2886 void ScXMLImport::LockSolarMutex()
2888 // #i62677# When called from DocShell/Wrapper, the SolarMutex is already locked,
2889 // so there's no need to allocate (and later delete) the ScUnoGuard.
2890 if (bFromWrapper)
2892 DBG_TESTSOLARMUTEX();
2893 return;
2896 if (nSolarMutexLocked == 0)
2898 DBG_ASSERT(!pScUnoGuard, "Solar Mutex is locked");
2899 pScUnoGuard = new ScUnoGuard();
2901 ++nSolarMutexLocked;
2905 void ScXMLImport::UnlockSolarMutex()
2907 if (nSolarMutexLocked > 0)
2909 nSolarMutexLocked--;
2910 if (nSolarMutexLocked == 0)
2912 DBG_ASSERT(pScUnoGuard, "Solar Mutex is always unlocked");
2913 delete pScUnoGuard;
2914 pScUnoGuard = NULL;
2919 sal_Int32 ScXMLImport::GetByteOffset()
2921 sal_Int32 nOffset = -1;
2922 uno::Reference<xml::sax::XLocator> xLocator = GetLocator();
2923 uno::Reference<io::XSeekable> xSeek( xLocator, uno::UNO_QUERY ); //! should use different interface
2924 if ( xSeek.is() )
2925 nOffset = (sal_Int32)xSeek->getPosition();
2926 return nOffset;
2929 void ScXMLImport::SetRangeOverflowType(sal_uInt32 nType)
2931 // #i31130# Overflow is stored in the document, because the ScXMLImport object
2932 // isn't available in ScXMLImportWrapper::ImportFromComponent when using the
2933 // OOo->Oasis transformation.
2935 if ( pDoc )
2936 pDoc->SetRangeOverflowType( nType );
2939 void ScXMLImport::ProgressBarIncrement(sal_Bool bEditCell, sal_Int32 nInc)
2941 nProgressCount += nInc;
2942 if (bEditCell || nProgressCount > 100)
2944 GetProgressBarHelper()->Increment(nProgressCount);
2945 nProgressCount = 0;
2949 sal_Int32 ScXMLImport::GetVisibleSheet()
2951 // Get the visible sheet number from model's view data (after settings were loaded),
2952 // or 0 (default: first sheet) if no settings available.
2954 uno::Reference<document::XViewDataSupplier> xSupp(GetModel(), uno::UNO_QUERY);
2955 if (xSupp.is())
2957 uno::Reference<container::XIndexAccess> xIndex = xSupp->getViewData();
2958 if ( xIndex.is() && xIndex->getCount() > 0 )
2960 uno::Any aAny( xIndex->getByIndex(0) );
2961 uno::Sequence<beans::PropertyValue> aViewSettings; // settings for (first) view
2962 if ( aAny >>= aViewSettings )
2964 sal_Int32 nCount = aViewSettings.getLength();
2965 for (sal_Int32 i = 0; i < nCount; ++i)
2967 if ( aViewSettings[i].Name.compareToAscii(SC_ACTIVETABLE) == 0 )
2969 rtl::OUString sValue;
2970 if(aViewSettings[i].Value >>= sValue)
2972 String sTabName(sValue);
2973 SCTAB nTab = 0;
2974 if (pDoc->GetTable(sTabName, nTab))
2975 return nTab;
2983 return 0;
2986 void ScXMLImport::ExtractFormulaNamespaceGrammar(
2987 OUString& rFormula, OUString& rFormulaNmsp, FormulaGrammar::Grammar& reGrammar,
2988 const OUString& rAttrValue, bool bRestrictToExternalNmsp ) const
2990 // parse the attribute value, extract namespace ID, literal namespace, and formula string
2991 rFormulaNmsp = OUString();
2992 sal_uInt16 nNsId = GetNamespaceMap()._GetKeyByAttrName( rAttrValue, 0, &rFormula, &rFormulaNmsp, sal_False );
2994 // check if we have an ODF formula namespace
2995 if( !bRestrictToExternalNmsp ) switch( nNsId )
2997 case XML_NAMESPACE_OOOC:
2998 rFormulaNmsp = OUString(); // remove namespace string for built-in grammar
2999 reGrammar = FormulaGrammar::GRAM_PODF;
3000 return;
3001 case XML_NAMESPACE_OF:
3002 rFormulaNmsp = OUString(); // remove namespace string for built-in grammar
3003 reGrammar = FormulaGrammar::GRAM_ODFF;
3004 return;
3007 /* Find default grammar for formulas without namespace. There may be
3008 documents in the wild that stored no namespace in ODF 1.0/1.1. Use
3009 GRAM_PODF then (old style ODF 1.0/1.1 formulas). The default for ODF
3010 1.2 and later without namespace is GRAM_ODFF (OpenFormula). */
3011 FormulaGrammar::Grammar eDefaultGrammar =
3012 (GetDocument()->GetStorageGrammar() == FormulaGrammar::GRAM_PODF) ?
3013 FormulaGrammar::GRAM_PODF : FormulaGrammar::GRAM_ODFF;
3015 /* Check if we have no namespace at all. The value XML_NAMESPACE_NONE
3016 indicates that there is no colon. If the first character of the
3017 attribute value is the equality sign, the value XML_NAMESPACE_UNKNOWN
3018 indicates that there is a colon somewhere in the formula string. */
3019 if( (nNsId == XML_NAMESPACE_NONE) || ((nNsId == XML_NAMESPACE_UNKNOWN) && (rAttrValue.toChar() == '=')) )
3021 rFormula = rAttrValue; // return entire string as formula
3022 reGrammar = eDefaultGrammar;
3023 return;
3026 /* Check if a namespace URL could be resolved from the attribute value.
3027 Use that namespace only, if the Calc document knows an associated
3028 external formula parser. This prevents that the range operator in
3029 conjunction with defined names is confused as namespaces prefix, e.g.
3030 in the expression 'table:A1' where 'table' is a named reference. */
3031 if( ((nNsId & XML_NAMESPACE_UNKNOWN_FLAG) != 0) && (rFormulaNmsp.getLength() > 0) &&
3032 GetDocument()->GetFormulaParserPool().hasFormulaParser( rFormulaNmsp ) )
3034 reGrammar = FormulaGrammar::GRAM_EXTERNAL;
3035 return;
3038 /* All attempts failed (e.g. no namespace and no leading equality sign, or
3039 an invalid namespace prefix), continue with the entire attribute value. */
3040 rFormula = rAttrValue;
3041 rFormulaNmsp = OUString(); // remove any namespace string
3042 reGrammar = eDefaultGrammar;