1 /**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License. You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied. See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_sc.hxx"
26
27 // INCLUDE ---------------------------------------------------------------
28
29 #include <svl/zforlist.hxx>
30
31 #include <xmloff/nmspmap.hxx>
32 #include <xmloff/xmlnmspe.hxx>
33 #include <xmloff/i18nmap.hxx>
34 #include <xmloff/xmltkmap.hxx>
35 #include <xmloff/xmlictxt.hxx>
36 #include <xmloff/xmlmetai.hxx>
37 #include <sfx2/objsh.hxx>
38 #include <xmloff/xmlnumfi.hxx>
39 #include <xmloff/xmlscripti.hxx>
40 #include <xmloff/XMLFontStylesContext.hxx>
41 #include <xmloff/DocumentSettingsContext.hxx>
42 #include <xmloff/xmluconv.hxx>
43 #include <xmloff/numehelp.hxx>
44 #include <xmloff/xmltoken.hxx>
45 #include <xmloff/xmlerror.hxx>
46
47 #include <svl/zforlist.hxx>
48 #include <svl/zformat.hxx>
49 #include <svl/languageoptions.hxx>
50
51 #include "xmlimprt.hxx"
52 #include "document.hxx"
53 #include "docuno.hxx"
54 #include "nameuno.hxx"
55 #include "xmlbodyi.hxx"
56 #include "xmlstyli.hxx"
57 #include "unoguard.hxx"
58 #include "ViewSettingsSequenceDefines.hxx"
59
60 #include "patattr.hxx"
61
62 #include "XMLConverter.hxx"
63 #include "XMLTableShapeImportHelper.hxx"
64 #include "XMLChangeTrackingImportHelper.hxx"
65 #include "chgviset.hxx"
66 #include "XMLStylesImportHelper.hxx"
67 #include "sheetdata.hxx"
68 #include "unonames.hxx"
69 #include "rangeutl.hxx"
70 #include "postit.hxx"
71 #include "formulaparserpool.hxx"
72 #include "externalrefmgr.hxx"
73 #include <comphelper/extract.hxx>
74
75 #include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
76 #include <com/sun/star/frame/XModel.hpp>
77 #include <com/sun/star/sheet/XSheetCellRange.hpp>
78 #include <com/sun/star/sheet/XCellRangeAddressable.hpp>
79 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
80 #include <com/sun/star/util/XMergeable.hpp>
81 #include <com/sun/star/sheet/CellInsertMode.hpp>
82 #include <com/sun/star/sheet/XCellRangeMovement.hpp>
83 #include <com/sun/star/document/XActionLockable.hpp>
84 #include <com/sun/star/util/NumberFormat.hpp>
85 #include <com/sun/star/util/XNumberFormatTypes.hpp>
86 #include <tools/urlobj.hxx>
87 #include <com/sun/star/sheet/XNamedRanges2.hpp>
88 #include <com/sun/star/sheet/NamedRangeFlag.hpp>
89 #include <com/sun/star/sheet/XNamedRange2.hpp>
90 #include <com/sun/star/sheet/XLabelRanges.hpp>
91 #include <com/sun/star/io/XSeekable.hpp>
92
93 #define SC_LOCALE "Locale"
94 #define SC_STANDARDFORMAT "StandardFormat"
95 #define SC_CURRENCYSYMBOL "CurrencySymbol"
96 #define SC_NAMEDRANGES "NamedRanges"
97 #define SC_REPEAT_COLUMN "repeat-column"
98 #define SC_REPEAT_ROW "repeat-row"
99 #define SC_FILTER "filter"
100 #define SC_PRINT_RANGE "print-range"
101
102 using namespace com::sun::star;
103 using namespace ::xmloff::token;
104 using namespace ::formula;
105 using ::rtl::OUString;
106
ScXMLImport_getImplementationName()107 OUString SAL_CALL ScXMLImport_getImplementationName() throw()
108 {
109 return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Calc.XMLOasisImporter" ) );
110 }
111
ScXMLImport_getSupportedServiceNames()112 uno::Sequence< rtl::OUString > SAL_CALL ScXMLImport_getSupportedServiceNames() throw()
113 {
114 const rtl::OUString aServiceName( ScXMLImport_getImplementationName() );
115 return uno::Sequence< rtl::OUString > ( &aServiceName, 1 );
116 }
117
ScXMLImport_createInstance(const uno::Reference<lang::XMultiServiceFactory> & rSMgr)118 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_createInstance(
119 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
120 {
121 // #110680#
122 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_ALL);
123 return (cppu::OWeakObject*)new ScXMLImport( rSMgr, IMPORT_ALL );
124 }
125
ScXMLImport_Meta_getImplementationName()126 OUString SAL_CALL ScXMLImport_Meta_getImplementationName() throw()
127 {
128 return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Calc.XMLOasisMetaImporter" ) );
129 }
130
ScXMLImport_Meta_getSupportedServiceNames()131 uno::Sequence< rtl::OUString > SAL_CALL ScXMLImport_Meta_getSupportedServiceNames() throw()
132 {
133 const rtl::OUString aServiceName( ScXMLImport_Meta_getImplementationName() );
134 return uno::Sequence< rtl::OUString > ( &aServiceName, 1 );
135 }
136
ScXMLImport_Meta_createInstance(const uno::Reference<lang::XMultiServiceFactory> & rSMgr)137 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Meta_createInstance(
138 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
139 {
140 // #110680#
141 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_META);
142 return (cppu::OWeakObject*)new ScXMLImport( rSMgr, IMPORT_META );
143 }
144
ScXMLImport_Styles_getImplementationName()145 OUString SAL_CALL ScXMLImport_Styles_getImplementationName() throw()
146 {
147 return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Calc.XMLOasisStylesImporter" ) );
148 }
149
ScXMLImport_Styles_getSupportedServiceNames()150 uno::Sequence< rtl::OUString > SAL_CALL ScXMLImport_Styles_getSupportedServiceNames() throw()
151 {
152 const rtl::OUString aServiceName( ScXMLImport_Styles_getImplementationName() );
153 return uno::Sequence< rtl::OUString > ( &aServiceName, 1 );
154 }
155
ScXMLImport_Styles_createInstance(const uno::Reference<lang::XMultiServiceFactory> & rSMgr)156 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Styles_createInstance(
157 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
158 {
159 // #110680#
160 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES|IMPORT_FONTDECLS);
161 return (cppu::OWeakObject*)new ScXMLImport( rSMgr, IMPORT_STYLES|IMPORT_AUTOSTYLES|IMPORT_MASTERSTYLES|IMPORT_FONTDECLS);
162 }
163
ScXMLImport_Content_getImplementationName()164 OUString SAL_CALL ScXMLImport_Content_getImplementationName() throw()
165 {
166 return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Calc.XMLOasisContentImporter" ) );
167 }
168
ScXMLImport_Content_getSupportedServiceNames()169 uno::Sequence< rtl::OUString > SAL_CALL ScXMLImport_Content_getSupportedServiceNames() throw()
170 {
171 const rtl::OUString aServiceName( ScXMLImport_Content_getImplementationName() );
172 return uno::Sequence< rtl::OUString > ( &aServiceName, 1 );
173 }
174
ScXMLImport_Content_createInstance(const uno::Reference<lang::XMultiServiceFactory> & rSMgr)175 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Content_createInstance(
176 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
177 {
178 // #110680#
179 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_META|IMPORT_STYLES|IMPORT_MASTERSTYLES|IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_SETTINGS|IMPORT_FONTDECLS);
180 return (cppu::OWeakObject*)new ScXMLImport( rSMgr, IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS);
181 }
182
ScXMLImport_Settings_getImplementationName()183 OUString SAL_CALL ScXMLImport_Settings_getImplementationName() throw()
184 {
185 return rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.Calc.XMLOasisSettingsImporter" ) );
186 }
187
ScXMLImport_Settings_getSupportedServiceNames()188 uno::Sequence< rtl::OUString > SAL_CALL ScXMLImport_Settings_getSupportedServiceNames() throw()
189 {
190 const rtl::OUString aServiceName( ScXMLImport_Settings_getImplementationName() );
191 return uno::Sequence< rtl::OUString > ( &aServiceName, 1 );
192 }
193
ScXMLImport_Settings_createInstance(const uno::Reference<lang::XMultiServiceFactory> & rSMgr)194 uno::Reference< uno::XInterface > SAL_CALL ScXMLImport_Settings_createInstance(
195 const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
196 {
197 // #110680#
198 // return (cppu::OWeakObject*)new ScXMLImport(IMPORT_SETTINGS);
199 return (cppu::OWeakObject*)new ScXMLImport( rSMgr, IMPORT_SETTINGS );
200 }
201
GetTableRowCellAttrTokenMap()202 const SvXMLTokenMap& ScXMLImport::GetTableRowCellAttrTokenMap()
203 {
204 static __FAR_DATA SvXMLTokenMapEntry aTableRowCellAttrTokenMap[] =
205 {
206 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_ROW_CELL_ATTR_STYLE_NAME },
207 { XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION_NAME, XML_TOK_TABLE_ROW_CELL_ATTR_CONTENT_VALIDATION_NAME },
208 { XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_ROWS },
209 { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_COLS },
210 { XML_NAMESPACE_TABLE, XML_NUMBER_MATRIX_COLUMNS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_COLS },
211 { XML_NAMESPACE_TABLE, XML_NUMBER_MATRIX_ROWS_SPANNED, XML_TOK_TABLE_ROW_CELL_ATTR_SPANNED_MATRIX_ROWS },
212 { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, XML_TOK_TABLE_ROW_CELL_ATTR_REPEATED },
213 { XML_NAMESPACE_OFFICE, XML_VALUE_TYPE, XML_TOK_TABLE_ROW_CELL_ATTR_VALUE_TYPE },
214 { XML_NAMESPACE_OFFICE, XML_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_VALUE },
215 { XML_NAMESPACE_OFFICE, XML_DATE_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_DATE_VALUE },
216 { XML_NAMESPACE_OFFICE, XML_TIME_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_TIME_VALUE },
217 { XML_NAMESPACE_OFFICE, XML_STRING_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_STRING_VALUE },
218 { XML_NAMESPACE_OFFICE, XML_BOOLEAN_VALUE, XML_TOK_TABLE_ROW_CELL_ATTR_BOOLEAN_VALUE },
219 { XML_NAMESPACE_TABLE, XML_FORMULA, XML_TOK_TABLE_ROW_CELL_ATTR_FORMULA },
220 { XML_NAMESPACE_OFFICE, XML_CURRENCY, XML_TOK_TABLE_ROW_CELL_ATTR_CURRENCY },
221 XML_TOKEN_MAP_END
222 };
223
224 if ( !pTableRowCellAttrTokenMap )
225 pTableRowCellAttrTokenMap = new SvXMLTokenMap( aTableRowCellAttrTokenMap );
226 return *pTableRowCellAttrTokenMap;
227 }
228
229 //----------------------------------------------------------------------------
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251 // NB: virtually inherit so we can multiply inherit properly
252 // in ScXMLFlatDocContext_Impl
253 class ScXMLDocContext_Impl : public virtual SvXMLImportContext
254 {
255 protected:
GetScImport() const256 const ScXMLImport& GetScImport() const { return (const ScXMLImport&)GetImport(); }
GetScImport()257 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
258
259 public:
260
261 ScXMLDocContext_Impl( ScXMLImport& rImport,
262 sal_uInt16 nPrfx,
263 const OUString& rLName,
264 const uno::Reference<xml::sax::XAttributeList>& xAttrList );
265 virtual ~ScXMLDocContext_Impl();
266
267 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
268 const rtl::OUString& rLocalName,
269 const uno::Reference<xml::sax::XAttributeList>& xAttrList );
270 };
271
ScXMLDocContext_Impl(ScXMLImport & rImport,sal_uInt16 nPrfx,const OUString & rLName,const uno::Reference<xml::sax::XAttributeList> &)272 ScXMLDocContext_Impl::ScXMLDocContext_Impl( ScXMLImport& rImport, sal_uInt16 nPrfx,
273 const OUString& rLName,
274 const uno::Reference<xml::sax::XAttributeList>& /* xAttrList */ ) :
275 SvXMLImportContext( rImport, nPrfx, rLName )
276 {
277
278 }
279
~ScXMLDocContext_Impl()280 ScXMLDocContext_Impl::~ScXMLDocContext_Impl()
281 {
282 }
283
284 // context for flat file xml format
285 class ScXMLFlatDocContext_Impl
286 : public ScXMLDocContext_Impl, public SvXMLMetaDocumentContext
287 {
288 public:
289 ScXMLFlatDocContext_Impl( ScXMLImport& i_rImport,
290 sal_uInt16 i_nPrefix, const OUString & i_rLName,
291 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
292 const uno::Reference<document::XDocumentProperties>& i_xDocProps,
293 const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder);
294
295 virtual ~ScXMLFlatDocContext_Impl();
296
297 virtual SvXMLImportContext *CreateChildContext(
298 sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
299 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList);
300 };
301
ScXMLFlatDocContext_Impl(ScXMLImport & i_rImport,sal_uInt16 i_nPrefix,const OUString & i_rLName,const uno::Reference<xml::sax::XAttributeList> & i_xAttrList,const uno::Reference<document::XDocumentProperties> & i_xDocProps,const uno::Reference<xml::sax::XDocumentHandler> & i_xDocBuilder)302 ScXMLFlatDocContext_Impl::ScXMLFlatDocContext_Impl( ScXMLImport& i_rImport,
303 sal_uInt16 i_nPrefix, const OUString & i_rLName,
304 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList,
305 const uno::Reference<document::XDocumentProperties>& i_xDocProps,
306 const uno::Reference<xml::sax::XDocumentHandler>& i_xDocBuilder) :
307 SvXMLImportContext(i_rImport, i_nPrefix, i_rLName),
308 ScXMLDocContext_Impl(i_rImport, i_nPrefix, i_rLName, i_xAttrList),
309 SvXMLMetaDocumentContext(i_rImport, i_nPrefix, i_rLName,
310 i_xDocProps, i_xDocBuilder)
311 {
312 }
313
~ScXMLFlatDocContext_Impl()314 ScXMLFlatDocContext_Impl::~ScXMLFlatDocContext_Impl() { }
315
316
CreateChildContext(sal_uInt16 i_nPrefix,const OUString & i_rLocalName,const uno::Reference<xml::sax::XAttributeList> & i_xAttrList)317 SvXMLImportContext *ScXMLFlatDocContext_Impl::CreateChildContext(
318 sal_uInt16 i_nPrefix, const OUString& i_rLocalName,
319 const uno::Reference<xml::sax::XAttributeList>& i_xAttrList)
320 {
321 // behave like meta base class iff we encounter office:meta
322 const SvXMLTokenMap& rTokenMap = GetScImport().GetDocElemTokenMap();
323 if ( XML_TOK_DOC_META == rTokenMap.Get( i_nPrefix, i_rLocalName ) ) {
324 return SvXMLMetaDocumentContext::CreateChildContext(
325 i_nPrefix, i_rLocalName, i_xAttrList );
326 } else {
327 return ScXMLDocContext_Impl::CreateChildContext(
328 i_nPrefix, i_rLocalName, i_xAttrList );
329 }
330 }
331
332 class ScXMLBodyContext_Impl : public SvXMLImportContext
333 {
GetScImport() const334 const ScXMLImport& GetScImport() const
335 { return (const ScXMLImport&)GetImport(); }
GetScImport()336 ScXMLImport& GetScImport() { return (ScXMLImport&)GetImport(); }
337
338 public:
339
340 ScXMLBodyContext_Impl( ScXMLImport& rImport, sal_uInt16 nPrfx,
341 const OUString& rLName,
342 const uno::Reference< xml::sax::XAttributeList > & xAttrList );
343 virtual ~ScXMLBodyContext_Impl();
344
345 virtual SvXMLImportContext *CreateChildContext( sal_uInt16 nPrefix,
346 const OUString& rLocalName,
347 const uno::Reference< xml::sax::XAttributeList > & xAttrList );
348 };
349
ScXMLBodyContext_Impl(ScXMLImport & rImport,sal_uInt16 nPrfx,const OUString & rLName,const uno::Reference<xml::sax::XAttributeList> &)350 ScXMLBodyContext_Impl::ScXMLBodyContext_Impl( ScXMLImport& rImport,
351 sal_uInt16 nPrfx, const OUString& rLName,
352 const uno::Reference< xml::sax::XAttributeList > & /* xAttrList */ ) :
353 SvXMLImportContext( rImport, nPrfx, rLName )
354 {
355 }
356
~ScXMLBodyContext_Impl()357 ScXMLBodyContext_Impl::~ScXMLBodyContext_Impl()
358 {
359 }
360
CreateChildContext(sal_uInt16,const OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList)361 SvXMLImportContext *ScXMLBodyContext_Impl::CreateChildContext(
362 sal_uInt16 /* nPrefix */,
363 const OUString& rLocalName,
364 const uno::Reference< xml::sax::XAttributeList > & xAttrList )
365 {
366 return GetScImport().CreateBodyContext( rLocalName, xAttrList );
367 }
368
CreateChildContext(sal_uInt16 nPrefix,const rtl::OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList)369 SvXMLImportContext *ScXMLDocContext_Impl::CreateChildContext( sal_uInt16 nPrefix,
370 const rtl::OUString& rLocalName,
371 const uno::Reference<xml::sax::XAttributeList>& xAttrList )
372 {
373 SvXMLImportContext *pContext(0);
374
375 const SvXMLTokenMap& rTokenMap(GetScImport().GetDocElemTokenMap());
376 switch( rTokenMap.Get( nPrefix, rLocalName ) )
377 {
378 case XML_TOK_DOC_FONTDECLS:
379 if (GetScImport().getImportFlags() & IMPORT_FONTDECLS)
380 pContext = GetScImport().CreateFontDeclsContext(nPrefix, rLocalName, xAttrList);
381 break;
382 case XML_TOK_DOC_STYLES:
383 if (GetScImport().getImportFlags() & IMPORT_STYLES)
384 pContext = GetScImport().CreateStylesContext( rLocalName, xAttrList, sal_False);
385 break;
386 case XML_TOK_DOC_AUTOSTYLES:
387 if (GetScImport().getImportFlags() & IMPORT_AUTOSTYLES)
388 pContext = GetScImport().CreateStylesContext( rLocalName, xAttrList, sal_True);
389 break;
390 case XML_TOK_DOC_MASTERSTYLES:
391 if (GetScImport().getImportFlags() & IMPORT_MASTERSTYLES)
392 pContext = new ScXMLMasterStylesContext( GetImport(), nPrefix, rLocalName,
393 xAttrList );
394 break;
395 case XML_TOK_DOC_META:
396 DBG_WARNING("XML_TOK_DOC_META: should not have come here, maybe document is invalid?");
397 break;
398 case XML_TOK_DOC_SCRIPTS:
399 if (GetScImport().getImportFlags() & IMPORT_SCRIPTS)
400 pContext = GetScImport().CreateScriptContext( rLocalName );
401 break;
402 case XML_TOK_DOC_BODY:
403 if (GetScImport().getImportFlags() & IMPORT_CONTENT)
404 pContext = new ScXMLBodyContext_Impl( GetScImport(), nPrefix,
405 rLocalName, xAttrList );
406 break;
407 case XML_TOK_DOC_SETTINGS:
408 if (GetScImport().getImportFlags() & IMPORT_SETTINGS)
409 pContext = new XMLDocumentSettingsContext(GetScImport(), nPrefix, rLocalName, xAttrList );
410 break;
411 }
412
413 if(!pContext)
414 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
415
416 return pContext;
417 }
418
GetDocElemTokenMap()419 const SvXMLTokenMap& ScXMLImport::GetDocElemTokenMap()
420 {
421 if( !pDocElemTokenMap )
422 {
423 static __FAR_DATA SvXMLTokenMapEntry aDocTokenMap[] =
424 {
425 { XML_NAMESPACE_OFFICE, XML_FONT_FACE_DECLS, XML_TOK_DOC_FONTDECLS },
426 { XML_NAMESPACE_OFFICE, XML_STYLES, XML_TOK_DOC_STYLES },
427 { XML_NAMESPACE_OFFICE, XML_AUTOMATIC_STYLES, XML_TOK_DOC_AUTOSTYLES },
428 { XML_NAMESPACE_OFFICE, XML_MASTER_STYLES, XML_TOK_DOC_MASTERSTYLES },
429 { XML_NAMESPACE_OFFICE, XML_META, XML_TOK_DOC_META },
430 { XML_NAMESPACE_OFFICE, XML_SCRIPTS, XML_TOK_DOC_SCRIPTS },
431 { XML_NAMESPACE_OFFICE, XML_BODY, XML_TOK_DOC_BODY },
432 { XML_NAMESPACE_OFFICE, XML_SETTINGS, XML_TOK_DOC_SETTINGS },
433 XML_TOKEN_MAP_END
434 };
435
436 pDocElemTokenMap = new SvXMLTokenMap( aDocTokenMap );
437
438 } // if( !pDocElemTokenMap )
439
440 return *pDocElemTokenMap;
441 }
442
443
GetBodyElemTokenMap()444 const SvXMLTokenMap& ScXMLImport::GetBodyElemTokenMap()
445 {
446 if( !pBodyElemTokenMap )
447 {
448 static __FAR_DATA SvXMLTokenMapEntry aBodyTokenMap[] =
449 {
450 { XML_NAMESPACE_TABLE, XML_TRACKED_CHANGES, XML_TOK_BODY_TRACKED_CHANGES },
451 { XML_NAMESPACE_TABLE, XML_CALCULATION_SETTINGS, XML_TOK_BODY_CALCULATION_SETTINGS },
452 { XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATIONS, XML_TOK_BODY_CONTENT_VALIDATIONS },
453 { XML_NAMESPACE_TABLE, XML_LABEL_RANGES, XML_TOK_BODY_LABEL_RANGES },
454 { XML_NAMESPACE_TABLE, XML_TABLE, XML_TOK_BODY_TABLE },
455 { XML_NAMESPACE_TABLE, XML_NAMED_EXPRESSIONS, XML_TOK_BODY_NAMED_EXPRESSIONS },
456 { XML_NAMESPACE_TABLE, XML_DATABASE_RANGES, XML_TOK_BODY_DATABASE_RANGES },
457 { XML_NAMESPACE_TABLE, XML_DATABASE_RANGE, XML_TOK_BODY_DATABASE_RANGE },
458 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_TABLES, XML_TOK_BODY_DATA_PILOT_TABLES },
459 { XML_NAMESPACE_TABLE, XML_CONSOLIDATION, XML_TOK_BODY_CONSOLIDATION },
460 { XML_NAMESPACE_TABLE, XML_DDE_LINKS, XML_TOK_BODY_DDE_LINKS },
461 XML_TOKEN_MAP_END
462 };
463
464 pBodyElemTokenMap = new SvXMLTokenMap( aBodyTokenMap );
465 } // if( !pBodyElemTokenMap )
466
467 return *pBodyElemTokenMap;
468 }
469
GetContentValidationsElemTokenMap()470 const SvXMLTokenMap& ScXMLImport::GetContentValidationsElemTokenMap()
471 {
472 if( !pContentValidationsElemTokenMap )
473 {
474 static __FAR_DATA SvXMLTokenMapEntry aContentValidationsElemTokenMap[] =
475 {
476 { XML_NAMESPACE_TABLE, XML_CONTENT_VALIDATION, XML_TOK_CONTENT_VALIDATION },
477 XML_TOKEN_MAP_END
478 };
479
480 pContentValidationsElemTokenMap = new SvXMLTokenMap( aContentValidationsElemTokenMap );
481 } // if( !pContentValidationsElemTokenMap )
482
483 return *pContentValidationsElemTokenMap;
484 }
485
GetContentValidationElemTokenMap()486 const SvXMLTokenMap& ScXMLImport::GetContentValidationElemTokenMap()
487 {
488 if( !pContentValidationElemTokenMap )
489 {
490 static __FAR_DATA SvXMLTokenMapEntry aContentValidationElemTokenMap[] =
491 {
492 { XML_NAMESPACE_TABLE, XML_HELP_MESSAGE, XML_TOK_CONTENT_VALIDATION_ELEM_HELP_MESSAGE },
493 { XML_NAMESPACE_TABLE, XML_ERROR_MESSAGE, XML_TOK_CONTENT_VALIDATION_ELEM_ERROR_MESSAGE },
494 { XML_NAMESPACE_TABLE, XML_ERROR_MACRO, XML_TOK_CONTENT_VALIDATION_ELEM_ERROR_MACRO },
495 { XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, XML_TOK_CONTENT_VALIDATION_ELEM_EVENT_LISTENERS },
496 XML_TOKEN_MAP_END
497 };
498
499 pContentValidationElemTokenMap = new SvXMLTokenMap( aContentValidationElemTokenMap );
500 } // if( !pContentValidationElemTokenMap )
501
502 return *pContentValidationElemTokenMap;
503 }
504
GetContentValidationAttrTokenMap()505 const SvXMLTokenMap& ScXMLImport::GetContentValidationAttrTokenMap()
506 {
507 if( !pContentValidationAttrTokenMap )
508 {
509 static __FAR_DATA SvXMLTokenMapEntry aContentValidationAttrTokenMap[] =
510 {
511 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_CONTENT_VALIDATION_NAME },
512 { XML_NAMESPACE_TABLE, XML_CONDITION, XML_TOK_CONTENT_VALIDATION_CONDITION },
513 { XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, XML_TOK_CONTENT_VALIDATION_BASE_CELL_ADDRESS },
514 { XML_NAMESPACE_TABLE, XML_ALLOW_EMPTY_CELL, XML_TOK_CONTENT_VALIDATION_ALLOW_EMPTY_CELL },
515 { XML_NAMESPACE_TABLE, XML_DISPLAY_LIST, XML_TOK_CONTENT_VALIDATION_DISPLAY_LIST },
516 XML_TOKEN_MAP_END
517 };
518
519 pContentValidationAttrTokenMap = new SvXMLTokenMap( aContentValidationAttrTokenMap );
520 } // if( !pContentValidationAttrTokenMap )
521
522 return *pContentValidationAttrTokenMap;
523 }
524
GetContentValidationMessageElemTokenMap()525 const SvXMLTokenMap& ScXMLImport::GetContentValidationMessageElemTokenMap()
526 {
527 if( !pContentValidationMessageElemTokenMap )
528 {
529 static __FAR_DATA SvXMLTokenMapEntry aContentValidationMessageElemTokenMap[] =
530 {
531 { XML_NAMESPACE_TEXT, XML_P, XML_TOK_P },
532 XML_TOKEN_MAP_END
533 };
534
535 pContentValidationMessageElemTokenMap = new SvXMLTokenMap( aContentValidationMessageElemTokenMap );
536 } // if( !pContentValidationMessageElemTokenMap )
537
538 return *pContentValidationMessageElemTokenMap;
539 }
540
GetContentValidationHelpMessageAttrTokenMap()541 const SvXMLTokenMap& ScXMLImport::GetContentValidationHelpMessageAttrTokenMap()
542 {
543 if( !pContentValidationHelpMessageAttrTokenMap )
544 {
545 static __FAR_DATA SvXMLTokenMapEntry aContentValidationHelpMessageAttrTokenMap[] =
546 {
547 { XML_NAMESPACE_TABLE, XML_TITLE, XML_TOK_HELP_MESSAGE_ATTR_TITLE },
548 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_HELP_MESSAGE_ATTR_DISPLAY },
549 XML_TOKEN_MAP_END
550 };
551
552 pContentValidationHelpMessageAttrTokenMap = new SvXMLTokenMap( aContentValidationHelpMessageAttrTokenMap );
553 } // if( !pContentValidationHelpMessageAttrTokenMap )
554
555 return *pContentValidationHelpMessageAttrTokenMap;
556 }
557
GetContentValidationErrorMessageAttrTokenMap()558 const SvXMLTokenMap& ScXMLImport::GetContentValidationErrorMessageAttrTokenMap()
559 {
560 if( !pContentValidationErrorMessageAttrTokenMap )
561 {
562 static __FAR_DATA SvXMLTokenMapEntry aContentValidationErrorMessageAttrTokenMap[] =
563 {
564 { XML_NAMESPACE_TABLE, XML_TITLE, XML_TOK_ERROR_MESSAGE_ATTR_TITLE },
565 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_ERROR_MESSAGE_ATTR_DISPLAY },
566 { XML_NAMESPACE_TABLE, XML_MESSAGE_TYPE, XML_TOK_ERROR_MESSAGE_ATTR_MESSAGE_TYPE },
567 XML_TOKEN_MAP_END
568 };
569
570 pContentValidationErrorMessageAttrTokenMap = new SvXMLTokenMap( aContentValidationErrorMessageAttrTokenMap );
571 } // if( !pContentValidationErrorMessageAttrTokenMap )
572
573 return *pContentValidationErrorMessageAttrTokenMap;
574 }
575
GetContentValidationErrorMacroAttrTokenMap()576 const SvXMLTokenMap& ScXMLImport::GetContentValidationErrorMacroAttrTokenMap()
577 {
578 if( !pContentValidationErrorMacroAttrTokenMap )
579 {
580 static __FAR_DATA SvXMLTokenMapEntry aContentValidationErrorMacroAttrTokenMap[] =
581 {
582 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_ERROR_MACRO_ATTR_NAME },
583 { XML_NAMESPACE_TABLE, XML_EXECUTE, XML_TOK_ERROR_MACRO_ATTR_EXECUTE },
584 XML_TOKEN_MAP_END
585 };
586
587 pContentValidationErrorMacroAttrTokenMap = new SvXMLTokenMap( aContentValidationErrorMacroAttrTokenMap );
588 } // if( !pContentValidationErrorMacroAttrTokenMap )
589
590 return *pContentValidationErrorMacroAttrTokenMap;
591 }
592
GetLabelRangesElemTokenMap()593 const SvXMLTokenMap& ScXMLImport::GetLabelRangesElemTokenMap()
594 {
595 if( !pLabelRangesElemTokenMap )
596 {
597 static __FAR_DATA SvXMLTokenMapEntry aLabelRangesElemTokenMap[] =
598 {
599 { XML_NAMESPACE_TABLE, XML_LABEL_RANGE, XML_TOK_LABEL_RANGE_ELEM },
600 XML_TOKEN_MAP_END
601 };
602
603 pLabelRangesElemTokenMap = new SvXMLTokenMap( aLabelRangesElemTokenMap );
604 } // if( !pLabelRangesElemTokenMap )
605
606 return *pLabelRangesElemTokenMap;
607 }
608
GetLabelRangeAttrTokenMap()609 const SvXMLTokenMap& ScXMLImport::GetLabelRangeAttrTokenMap()
610 {
611 if( !pLabelRangeAttrTokenMap )
612 {
613 static __FAR_DATA SvXMLTokenMapEntry aLabelRangeAttrTokenMap[] =
614 {
615 { XML_NAMESPACE_TABLE, XML_LABEL_CELL_RANGE_ADDRESS, XML_TOK_LABEL_RANGE_ATTR_LABEL_RANGE },
616 { XML_NAMESPACE_TABLE, XML_DATA_CELL_RANGE_ADDRESS, XML_TOK_LABEL_RANGE_ATTR_DATA_RANGE },
617 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_LABEL_RANGE_ATTR_ORIENTATION },
618 XML_TOKEN_MAP_END
619 };
620
621 pLabelRangeAttrTokenMap = new SvXMLTokenMap( aLabelRangeAttrTokenMap );
622 } // if( !pLabelRangeAttrTokenMap )
623
624 return *pLabelRangeAttrTokenMap;
625 }
626
GetTableElemTokenMap()627 const SvXMLTokenMap& ScXMLImport::GetTableElemTokenMap()
628 {
629 if( !pTableElemTokenMap )
630 {
631 static __FAR_DATA SvXMLTokenMapEntry aTableTokenMap[] =
632 {
633 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN_GROUP, XML_TOK_TABLE_COL_GROUP },
634 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_COLUMNS, XML_TOK_TABLE_HEADER_COLS },
635 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, XML_TOK_TABLE_COLS },
636 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, XML_TOK_TABLE_COL },
637 { XML_NAMESPACE_TABLE, XML_TABLE_ROW_GROUP, XML_TOK_TABLE_ROW_GROUP },
638 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_ROWS, XML_TOK_TABLE_HEADER_ROWS },
639 { XML_NAMESPACE_TABLE, XML_TABLE_ROWS, XML_TOK_TABLE_ROWS },
640 { XML_NAMESPACE_TABLE, XML_TABLE_ROW, XML_TOK_TABLE_ROW },
641 { XML_NAMESPACE_TABLE, XML_TABLE_SOURCE, XML_TOK_TABLE_SOURCE },
642 { XML_NAMESPACE_TABLE, XML_SCENARIO, XML_TOK_TABLE_SCENARIO },
643 { XML_NAMESPACE_TABLE, XML_NAMED_EXPRESSIONS, XML_TOK_TABLE_NAMED_EXPRESSIONS },
644 { XML_NAMESPACE_TABLE, XML_SHAPES, XML_TOK_TABLE_SHAPES },
645 { XML_NAMESPACE_OFFICE, XML_FORMS, XML_TOK_TABLE_FORMS },
646 { XML_NAMESPACE_OFFICE, XML_EVENT_LISTENERS, XML_TOK_TABLE_EVENT_LISTENERS },
647 { XML_NAMESPACE_OFFICE_EXT, XML_EVENT_LISTENERS, XML_TOK_TABLE_EVENT_LISTENERS_EXT },
648 XML_TOKEN_MAP_END
649 };
650
651 pTableElemTokenMap = new SvXMLTokenMap( aTableTokenMap );
652 } // if( !pTableElemTokenMap )
653
654 return *pTableElemTokenMap;
655 }
656
GetTableRowsElemTokenMap()657 const SvXMLTokenMap& ScXMLImport::GetTableRowsElemTokenMap()
658 {
659 if( !pTableRowsElemTokenMap )
660 {
661 static __FAR_DATA SvXMLTokenMapEntry aTableRowsElemTokenMap[] =
662 {
663 { XML_NAMESPACE_TABLE, XML_TABLE_ROW_GROUP, XML_TOK_TABLE_ROWS_ROW_GROUP },
664 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_ROWS, XML_TOK_TABLE_ROWS_HEADER_ROWS },
665 { XML_NAMESPACE_TABLE, XML_TABLE_ROWS, XML_TOK_TABLE_ROWS_ROWS },
666 { XML_NAMESPACE_TABLE, XML_TABLE_ROW, XML_TOK_TABLE_ROWS_ROW },
667 XML_TOKEN_MAP_END
668 };
669
670 pTableRowsElemTokenMap = new SvXMLTokenMap( aTableRowsElemTokenMap );
671 } // if( !pTableRowsElemTokenMap )
672
673 return *pTableRowsElemTokenMap;
674 }
675
GetTableColsElemTokenMap()676 const SvXMLTokenMap& ScXMLImport::GetTableColsElemTokenMap()
677 {
678 if( !pTableColsElemTokenMap )
679 {
680 static __FAR_DATA SvXMLTokenMapEntry aTableColsElemTokenMap[] =
681 {
682 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN_GROUP, XML_TOK_TABLE_COLS_COL_GROUP },
683 { XML_NAMESPACE_TABLE, XML_TABLE_HEADER_COLUMNS, XML_TOK_TABLE_COLS_HEADER_COLS },
684 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMNS, XML_TOK_TABLE_COLS_COLS },
685 { XML_NAMESPACE_TABLE, XML_TABLE_COLUMN, XML_TOK_TABLE_COLS_COL },
686 XML_TOKEN_MAP_END
687 };
688
689 pTableColsElemTokenMap = new SvXMLTokenMap( aTableColsElemTokenMap );
690 } // if( !pTableColsElemTokenMap )
691
692 return *pTableColsElemTokenMap;
693 }
694
GetTableAttrTokenMap()695 const SvXMLTokenMap& ScXMLImport::GetTableAttrTokenMap()
696 {
697 if( !pTableAttrTokenMap )
698 {
699 static __FAR_DATA SvXMLTokenMapEntry aTableAttrTokenMap[] =
700 {
701 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_TABLE_NAME },
702 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_STYLE_NAME },
703 { XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TOK_TABLE_PROTECTION },
704 { XML_NAMESPACE_TABLE, XML_PRINT_RANGES, XML_TOK_TABLE_PRINT_RANGES },
705 { XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, XML_TOK_TABLE_PASSWORD },
706 { XML_NAMESPACE_TABLE, XML_PRINT, XML_TOK_TABLE_PRINT },
707 XML_TOKEN_MAP_END
708 };
709
710 pTableAttrTokenMap = new SvXMLTokenMap( aTableAttrTokenMap );
711 } // if( !pTableAttrTokenMap )
712
713 return *pTableAttrTokenMap;
714 }
715
GetTableScenarioAttrTokenMap()716 const SvXMLTokenMap& ScXMLImport::GetTableScenarioAttrTokenMap()
717 {
718 if( !pTableScenarioAttrTokenMap )
719 {
720 static __FAR_DATA SvXMLTokenMapEntry aTableScenarioAttrTokenMap[] =
721 {
722 { XML_NAMESPACE_TABLE, XML_DISPLAY_BORDER, XML_TOK_TABLE_SCENARIO_ATTR_DISPLAY_BORDER },
723 { XML_NAMESPACE_TABLE, XML_BORDER_COLOR, XML_TOK_TABLE_SCENARIO_ATTR_BORDER_COLOR },
724 { XML_NAMESPACE_TABLE, XML_COPY_BACK, XML_TOK_TABLE_SCENARIO_ATTR_COPY_BACK },
725 { XML_NAMESPACE_TABLE, XML_COPY_STYLES, XML_TOK_TABLE_SCENARIO_ATTR_COPY_STYLES },
726 { XML_NAMESPACE_TABLE, XML_COPY_FORMULAS, XML_TOK_TABLE_SCENARIO_ATTR_COPY_FORMULAS },
727 { XML_NAMESPACE_TABLE, XML_IS_ACTIVE, XML_TOK_TABLE_SCENARIO_ATTR_IS_ACTIVE },
728 { XML_NAMESPACE_TABLE, XML_SCENARIO_RANGES, XML_TOK_TABLE_SCENARIO_ATTR_SCENARIO_RANGES },
729 { XML_NAMESPACE_TABLE, XML_COMMENT, XML_TOK_TABLE_SCENARIO_ATTR_COMMENT },
730 { XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TOK_TABLE_SCENARIO_ATTR_PROTECTED },
731 XML_TOKEN_MAP_END
732 };
733
734 pTableScenarioAttrTokenMap = new SvXMLTokenMap( aTableScenarioAttrTokenMap );
735 } // if( !pTableScenarioAttrTokenMap )
736
737 return *pTableScenarioAttrTokenMap;
738 }
739
GetTableColAttrTokenMap()740 const SvXMLTokenMap& ScXMLImport::GetTableColAttrTokenMap()
741 {
742 if( !pTableColAttrTokenMap )
743 {
744 static __FAR_DATA SvXMLTokenMapEntry aTableColAttrTokenMap[] =
745 {
746 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_COL_ATTR_STYLE_NAME },
747 { XML_NAMESPACE_TABLE, XML_NUMBER_COLUMNS_REPEATED, XML_TOK_TABLE_COL_ATTR_REPEATED },
748 { XML_NAMESPACE_TABLE, XML_VISIBILITY, XML_TOK_TABLE_COL_ATTR_VISIBILITY },
749 { XML_NAMESPACE_TABLE, XML_DEFAULT_CELL_STYLE_NAME, XML_TOK_TABLE_COL_ATTR_DEFAULT_CELL_STYLE_NAME },
750 XML_TOKEN_MAP_END
751 };
752
753 pTableColAttrTokenMap = new SvXMLTokenMap( aTableColAttrTokenMap );
754 } // if( !pTableColAttrTokenMap )
755
756 return *pTableColAttrTokenMap;
757 }
758
GetTableRowElemTokenMap()759 const SvXMLTokenMap& ScXMLImport::GetTableRowElemTokenMap()
760 {
761 if( !pTableRowElemTokenMap )
762 {
763 static __FAR_DATA SvXMLTokenMapEntry aTableRowTokenMap[] =
764 {
765 { XML_NAMESPACE_TABLE, XML_TABLE_CELL, XML_TOK_TABLE_ROW_CELL },
766 { XML_NAMESPACE_TABLE, XML_COVERED_TABLE_CELL, XML_TOK_TABLE_ROW_COVERED_CELL },
767 XML_TOKEN_MAP_END
768 };
769
770 pTableRowElemTokenMap = new SvXMLTokenMap( aTableRowTokenMap );
771 } // if( !pTableRowElemTokenMap )
772
773 return *pTableRowElemTokenMap;
774 }
775
GetTableRowAttrTokenMap()776 const SvXMLTokenMap& ScXMLImport::GetTableRowAttrTokenMap()
777 {
778 if( !pTableRowAttrTokenMap )
779 {
780 static __FAR_DATA SvXMLTokenMapEntry aTableRowAttrTokenMap[] =
781 {
782 { XML_NAMESPACE_TABLE, XML_STYLE_NAME, XML_TOK_TABLE_ROW_ATTR_STYLE_NAME },
783 { XML_NAMESPACE_TABLE, XML_VISIBILITY, XML_TOK_TABLE_ROW_ATTR_VISIBILITY },
784 { XML_NAMESPACE_TABLE, XML_NUMBER_ROWS_REPEATED, XML_TOK_TABLE_ROW_ATTR_REPEATED },
785 { XML_NAMESPACE_TABLE, XML_DEFAULT_CELL_STYLE_NAME, XML_TOK_TABLE_ROW_ATTR_DEFAULT_CELL_STYLE_NAME },
786 // { XML_NAMESPACE_TABLE, XML_USE_OPTIMAL_HEIGHT, XML_TOK_TABLE_ROW_ATTR_USE_OPTIMAL_HEIGHT },
787 XML_TOKEN_MAP_END
788 };
789
790 pTableRowAttrTokenMap = new SvXMLTokenMap( aTableRowAttrTokenMap );
791 } // if( !pTableRowAttrTokenMap )
792
793 return *pTableRowAttrTokenMap;
794 }
795
GetTableRowCellElemTokenMap()796 const SvXMLTokenMap& ScXMLImport::GetTableRowCellElemTokenMap()
797 {
798 if( !pTableRowCellElemTokenMap )
799 {
800 static __FAR_DATA SvXMLTokenMapEntry aTableRowCellTokenMap[] =
801 {
802 { XML_NAMESPACE_TEXT, XML_P, XML_TOK_TABLE_ROW_CELL_P },
803 { XML_NAMESPACE_TABLE, XML_SUB_TABLE, XML_TOK_TABLE_ROW_CELL_TABLE },
804 { XML_NAMESPACE_OFFICE, XML_ANNOTATION, XML_TOK_TABLE_ROW_CELL_ANNOTATION },
805 { XML_NAMESPACE_TABLE, XML_DETECTIVE, XML_TOK_TABLE_ROW_CELL_DETECTIVE },
806 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_SOURCE, XML_TOK_TABLE_ROW_CELL_CELL_RANGE_SOURCE },
807 XML_TOKEN_MAP_END
808 };
809
810 pTableRowCellElemTokenMap = new SvXMLTokenMap( aTableRowCellTokenMap );
811 } // if( !pTableRowCellElemTokenMap )
812
813 return *pTableRowCellElemTokenMap;
814 }
815
GetTableAnnotationAttrTokenMap()816 const SvXMLTokenMap& ScXMLImport::GetTableAnnotationAttrTokenMap()
817 {
818 if( !pTableAnnotationAttrTokenMap )
819 {
820 static __FAR_DATA SvXMLTokenMapEntry aTableAnnotationAttrTokenMap[] =
821 {
822 { XML_NAMESPACE_OFFICE, XML_AUTHOR, XML_TOK_TABLE_ANNOTATION_ATTR_AUTHOR },
823 { XML_NAMESPACE_OFFICE, XML_CREATE_DATE, XML_TOK_TABLE_ANNOTATION_ATTR_CREATE_DATE },
824 { XML_NAMESPACE_OFFICE, XML_CREATE_DATE_STRING, XML_TOK_TABLE_ANNOTATION_ATTR_CREATE_DATE_STRING },
825 { XML_NAMESPACE_OFFICE, XML_DISPLAY, XML_TOK_TABLE_ANNOTATION_ATTR_DISPLAY },
826 { XML_NAMESPACE_SVG, XML_X, XML_TOK_TABLE_ANNOTATION_ATTR_X },
827 { XML_NAMESPACE_SVG, XML_Y, XML_TOK_TABLE_ANNOTATION_ATTR_Y },
828 XML_TOKEN_MAP_END
829 };
830
831 pTableAnnotationAttrTokenMap = new SvXMLTokenMap( aTableAnnotationAttrTokenMap );
832 } // if( !pTableAnnotationAttrTokenMap )
833
834 return *pTableAnnotationAttrTokenMap;
835 }
836
GetDetectiveElemTokenMap()837 const SvXMLTokenMap& ScXMLImport::GetDetectiveElemTokenMap()
838 {
839 if( !pDetectiveElemTokenMap )
840 {
841 static __FAR_DATA SvXMLTokenMapEntry aDetectiveElemTokenMap[]=
842 {
843 { XML_NAMESPACE_TABLE, XML_HIGHLIGHTED_RANGE, XML_TOK_DETECTIVE_ELEM_HIGHLIGHTED },
844 { XML_NAMESPACE_TABLE, XML_OPERATION, XML_TOK_DETECTIVE_ELEM_OPERATION },
845 XML_TOKEN_MAP_END
846 };
847
848 pDetectiveElemTokenMap = new SvXMLTokenMap( aDetectiveElemTokenMap );
849 } // if( !pDetectiveElemTokenMap )
850
851 return *pDetectiveElemTokenMap;
852 }
853
GetDetectiveHighlightedAttrTokenMap()854 const SvXMLTokenMap& ScXMLImport::GetDetectiveHighlightedAttrTokenMap()
855 {
856 if( !pDetectiveHighlightedAttrTokenMap )
857 {
858 static __FAR_DATA SvXMLTokenMapEntry aDetectiveHighlightedAttrTokenMap[]=
859 {
860 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_CELL_RANGE },
861 { XML_NAMESPACE_TABLE, XML_DIRECTION, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_DIRECTION },
862 { XML_NAMESPACE_TABLE, XML_CONTAINS_ERROR, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_CONTAINS_ERROR },
863 { XML_NAMESPACE_TABLE, XML_MARKED_INVALID, XML_TOK_DETECTIVE_HIGHLIGHTED_ATTR_MARKED_INVALID },
864 XML_TOKEN_MAP_END
865 };
866
867 pDetectiveHighlightedAttrTokenMap = new SvXMLTokenMap( aDetectiveHighlightedAttrTokenMap );
868 } // if( !pDetectiveHighlightedAttrTokenMap )
869
870 return *pDetectiveHighlightedAttrTokenMap;
871 }
872
GetDetectiveOperationAttrTokenMap()873 const SvXMLTokenMap& ScXMLImport::GetDetectiveOperationAttrTokenMap()
874 {
875 if( !pDetectiveOperationAttrTokenMap )
876 {
877 static __FAR_DATA SvXMLTokenMapEntry aDetectiveOperationAttrTokenMap[]=
878 {
879 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DETECTIVE_OPERATION_ATTR_NAME },
880 { XML_NAMESPACE_TABLE, XML_INDEX, XML_TOK_DETECTIVE_OPERATION_ATTR_INDEX },
881 XML_TOKEN_MAP_END
882 };
883
884 pDetectiveOperationAttrTokenMap = new SvXMLTokenMap( aDetectiveOperationAttrTokenMap );
885 } // if( !pDetectiveOperationAttrTokenMap )
886
887 return *pDetectiveOperationAttrTokenMap;
888 }
889
GetTableCellRangeSourceAttrTokenMap()890 const SvXMLTokenMap& ScXMLImport::GetTableCellRangeSourceAttrTokenMap()
891 {
892 if( !pTableCellRangeSourceAttrTokenMap )
893 {
894 static __FAR_DATA SvXMLTokenMapEntry aTableCellRangeSourceAttrTokenMap[] =
895 {
896 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_NAME },
897 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_HREF },
898 { XML_NAMESPACE_TABLE, XML_FILTER_NAME, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_NAME },
899 { XML_NAMESPACE_TABLE, XML_FILTER_OPTIONS, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_FILTER_OPTIONS },
900 { XML_NAMESPACE_TABLE, XML_LAST_COLUMN_SPANNED, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_COLUMN },
901 { XML_NAMESPACE_TABLE, XML_LAST_ROW_SPANNED, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_LAST_ROW },
902 { XML_NAMESPACE_TABLE, XML_REFRESH_DELAY, XML_TOK_TABLE_CELL_RANGE_SOURCE_ATTR_REFRESH_DELAY },
903 XML_TOKEN_MAP_END
904 };
905
906 pTableCellRangeSourceAttrTokenMap = new SvXMLTokenMap( aTableCellRangeSourceAttrTokenMap );
907 } // if( !pTableCellRangeSourceAttrTokenMap )
908
909 return *pTableCellRangeSourceAttrTokenMap;
910 }
911
GetNamedExpressionsElemTokenMap()912 const SvXMLTokenMap& ScXMLImport::GetNamedExpressionsElemTokenMap()
913 {
914 if( !pNamedExpressionsElemTokenMap )
915 {
916 static __FAR_DATA SvXMLTokenMapEntry aNamedExpressionsTokenMap[] =
917 {
918 { XML_NAMESPACE_TABLE, XML_NAMED_RANGE, XML_TOK_NAMED_EXPRESSIONS_NAMED_RANGE },
919 { XML_NAMESPACE_TABLE, XML_NAMED_EXPRESSION, XML_TOK_NAMED_EXPRESSIONS_NAMED_EXPRESSION },
920 XML_TOKEN_MAP_END
921 };
922
923 pNamedExpressionsElemTokenMap = new SvXMLTokenMap( aNamedExpressionsTokenMap );
924 } // if( !pNamedExpressionsElemTokenMap )
925
926 return *pNamedExpressionsElemTokenMap;
927 }
928
GetNamedRangeAttrTokenMap()929 const SvXMLTokenMap& ScXMLImport::GetNamedRangeAttrTokenMap()
930 {
931 if( !pNamedRangeAttrTokenMap )
932 {
933 static __FAR_DATA SvXMLTokenMapEntry aNamedRangeAttrTokenMap[] =
934 {
935 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_NAMED_RANGE_ATTR_NAME },
936 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, XML_TOK_NAMED_RANGE_ATTR_CELL_RANGE_ADDRESS },
937 { XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, XML_TOK_NAMED_RANGE_ATTR_BASE_CELL_ADDRESS },
938 { XML_NAMESPACE_TABLE, XML_RANGE_USABLE_AS, XML_TOK_NAMED_RANGE_ATTR_RANGE_USABLE_AS },
939 XML_TOKEN_MAP_END
940 };
941
942 pNamedRangeAttrTokenMap = new SvXMLTokenMap( aNamedRangeAttrTokenMap );
943 } // if( !pNamedRangeAttrTokenMap )
944
945 return *pNamedRangeAttrTokenMap;
946 }
947
GetNamedExpressionAttrTokenMap()948 const SvXMLTokenMap& ScXMLImport::GetNamedExpressionAttrTokenMap()
949 {
950 if( !pNamedExpressionAttrTokenMap )
951 {
952 static __FAR_DATA SvXMLTokenMapEntry aNamedExpressionAttrTokenMap[] =
953 {
954 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_NAMED_EXPRESSION_ATTR_NAME },
955 { XML_NAMESPACE_TABLE, XML_BASE_CELL_ADDRESS, XML_TOK_NAMED_EXPRESSION_ATTR_BASE_CELL_ADDRESS },
956 { XML_NAMESPACE_TABLE, XML_EXPRESSION, XML_TOK_NAMED_EXPRESSION_ATTR_EXPRESSION },
957 XML_TOKEN_MAP_END
958 };
959
960 pNamedExpressionAttrTokenMap = new SvXMLTokenMap( aNamedExpressionAttrTokenMap );
961 } // if( !pNamedExpressionAttrTokenMap )
962
963 return *pNamedExpressionAttrTokenMap;
964 }
965
GetDatabaseRangesElemTokenMap()966 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangesElemTokenMap()
967 {
968 if( !pDatabaseRangesElemTokenMap )
969 {
970 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangesTokenMap[] =
971 {
972 { XML_NAMESPACE_TABLE, XML_DATABASE_RANGE, XML_TOK_DATABASE_RANGE },
973 XML_TOKEN_MAP_END
974 };
975
976 pDatabaseRangesElemTokenMap = new SvXMLTokenMap( aDatabaseRangesTokenMap );
977 } // if( !pDatabaseRangesElemTokenMap )
978
979 return *pDatabaseRangesElemTokenMap;
980 }
981
GetDatabaseRangeElemTokenMap()982 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeElemTokenMap()
983 {
984 if( !pDatabaseRangeElemTokenMap )
985 {
986 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangeTokenMap[] =
987 {
988 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_SQL, XML_TOK_DATABASE_RANGE_SOURCE_SQL },
989 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_TABLE, XML_TOK_DATABASE_RANGE_SOURCE_TABLE },
990 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_QUERY, XML_TOK_DATABASE_RANGE_SOURCE_QUERY },
991 { XML_NAMESPACE_TABLE, XML_FILTER, XML_TOK_FILTER },
992 { XML_NAMESPACE_TABLE, XML_SORT, XML_TOK_SORT },
993 { XML_NAMESPACE_TABLE, XML_SUBTOTAL_RULES, XML_TOK_DATABASE_RANGE_SUBTOTAL_RULES },
994 XML_TOKEN_MAP_END
995 };
996
997 pDatabaseRangeElemTokenMap = new SvXMLTokenMap( aDatabaseRangeTokenMap );
998 } // if( !pDatabaseRangeElemTokenMap )
999
1000 return *pDatabaseRangeElemTokenMap;
1001 }
1002
GetDatabaseRangeAttrTokenMap()1003 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeAttrTokenMap()
1004 {
1005 if( !pDatabaseRangeAttrTokenMap )
1006 {
1007 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangeAttrTokenMap[] =
1008 {
1009 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DATABASE_RANGE_ATTR_NAME },
1010 { XML_NAMESPACE_TABLE, XML_IS_SELECTION, XML_TOK_DATABASE_RANGE_ATTR_IS_SELECTION },
1011 { XML_NAMESPACE_TABLE, XML_ON_UPDATE_KEEP_STYLES, XML_TOK_DATABASE_RANGE_ATTR_ON_UPDATE_KEEP_STYLES },
1012 { XML_NAMESPACE_TABLE, XML_ON_UPDATE_KEEP_SIZE, XML_TOK_DATABASE_RANGE_ATTR_ON_UPDATE_KEEP_SIZE },
1013 { XML_NAMESPACE_TABLE, XML_HAS_PERSISTENT_DATA, XML_TOK_DATABASE_RANGE_ATTR_HAS_PERSISTENT_DATA },
1014 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_DATABASE_RANGE_ATTR_ORIENTATION },
1015 { XML_NAMESPACE_TABLE, XML_CONTAINS_HEADER, XML_TOK_DATABASE_RANGE_ATTR_CONTAINS_HEADER },
1016 { XML_NAMESPACE_TABLE, XML_DISPLAY_FILTER_BUTTONS, XML_TOK_DATABASE_RANGE_ATTR_DISPLAY_FILTER_BUTTONS },
1017 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_DATABASE_RANGE_ATTR_TARGET_RANGE_ADDRESS },
1018 { XML_NAMESPACE_TABLE, XML_REFRESH_DELAY, XML_TOK_DATABASE_RANGE_ATTR_REFRESH_DELAY },
1019 XML_TOKEN_MAP_END
1020 };
1021
1022 pDatabaseRangeAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeAttrTokenMap );
1023 } // if( !pDatabaseRangeAttrTokenMap )
1024
1025 return *pDatabaseRangeAttrTokenMap;
1026 }
1027
GetDatabaseRangeSourceSQLAttrTokenMap()1028 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSourceSQLAttrTokenMap()
1029 {
1030 if( !pDatabaseRangeSourceSQLAttrTokenMap )
1031 {
1032 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangeSourceSQLAttrTokenMap[] =
1033 {
1034 { XML_NAMESPACE_TABLE, XML_DATABASE_NAME, XML_TOK_SOURCE_SQL_ATTR_DATABASE_NAME },
1035 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SOURCE_SQL_ATTR_HREF },
1036 { XML_NAMESPACE_TABLE, XML_CONNECTION_RESOURCE, XML_TOK_SOURCE_SQL_ATTR_CONNECTION_RESSOURCE},
1037 { XML_NAMESPACE_TABLE, XML_SQL_STATEMENT, XML_TOK_SOURCE_SQL_ATTR_SQL_STATEMENT },
1038 { XML_NAMESPACE_TABLE, XML_PARSE_SQL_STATEMENT, XML_TOK_SOURCE_SQL_ATTR_PARSE_SQL_STATEMENT },
1039 XML_TOKEN_MAP_END
1040 };
1041
1042 pDatabaseRangeSourceSQLAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSourceSQLAttrTokenMap );
1043 } // if( !pDatabaseRangeSourceSQLAttrTokenMap )
1044
1045 return *pDatabaseRangeSourceSQLAttrTokenMap;
1046 }
1047
GetDatabaseRangeSourceTableAttrTokenMap()1048 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSourceTableAttrTokenMap()
1049 {
1050 if( !pDatabaseRangeSourceTableAttrTokenMap )
1051 {
1052 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangeSourceTableAttrTokenMap[] =
1053 {
1054 { XML_NAMESPACE_TABLE, XML_DATABASE_NAME, XML_TOK_SOURCE_TABLE_ATTR_DATABASE_NAME },
1055 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SOURCE_TABLE_ATTR_HREF },
1056 { XML_NAMESPACE_TABLE, XML_CONNECTION_RESOURCE, XML_TOK_SOURCE_TABLE_ATTR_CONNECTION_RESSOURCE },
1057 { XML_NAMESPACE_TABLE, XML_TABLE_NAME, XML_TOK_SOURCE_TABLE_ATTR_TABLE_NAME },
1058 XML_TOKEN_MAP_END
1059 };
1060
1061 pDatabaseRangeSourceTableAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSourceTableAttrTokenMap );
1062 } // if( !pDatabaseRangeSourceTableAttrTokenMap )
1063
1064 return *pDatabaseRangeSourceTableAttrTokenMap;
1065 }
1066
GetDatabaseRangeSourceQueryAttrTokenMap()1067 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSourceQueryAttrTokenMap()
1068 {
1069 if( !pDatabaseRangeSourceQueryAttrTokenMap )
1070 {
1071 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangeSourceQueryAttrTokenMap[] =
1072 {
1073 { XML_NAMESPACE_TABLE, XML_DATABASE_NAME, XML_TOK_SOURCE_QUERY_ATTR_DATABASE_NAME },
1074 { XML_NAMESPACE_XLINK, XML_HREF, XML_TOK_SOURCE_QUERY_ATTR_HREF },
1075 { XML_NAMESPACE_TABLE, XML_CONNECTION_RESOURCE, XML_TOK_SOURCE_QUERY_ATTR_CONNECTION_RESSOURCE },
1076 { XML_NAMESPACE_TABLE, XML_QUERY_NAME, XML_TOK_SOURCE_QUERY_ATTR_QUERY_NAME },
1077 XML_TOKEN_MAP_END
1078 };
1079
1080 pDatabaseRangeSourceQueryAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSourceQueryAttrTokenMap );
1081 } // if( !pDatabaseRangeSourceQueryAttrTokenMap )
1082
1083 return *pDatabaseRangeSourceQueryAttrTokenMap;
1084 }
1085
GetFilterElemTokenMap()1086 const SvXMLTokenMap& ScXMLImport::GetFilterElemTokenMap()
1087 {
1088 if( !pFilterElemTokenMap )
1089 {
1090 static __FAR_DATA SvXMLTokenMapEntry aFilterTokenMap[] =
1091 {
1092 { XML_NAMESPACE_TABLE, XML_FILTER_AND, XML_TOK_FILTER_AND },
1093 { XML_NAMESPACE_TABLE, XML_FILTER_OR, XML_TOK_FILTER_OR },
1094 { XML_NAMESPACE_TABLE, XML_FILTER_CONDITION, XML_TOK_FILTER_CONDITION },
1095 XML_TOKEN_MAP_END
1096 };
1097
1098 pFilterElemTokenMap = new SvXMLTokenMap( aFilterTokenMap );
1099 } // if( !pFilterElemTokenMap )
1100
1101 return *pFilterElemTokenMap;
1102 }
1103
GetFilterAttrTokenMap()1104 const SvXMLTokenMap& ScXMLImport::GetFilterAttrTokenMap()
1105 {
1106 if( !pFilterAttrTokenMap )
1107 {
1108 static __FAR_DATA SvXMLTokenMapEntry aFilterAttrTokenMap[] =
1109 {
1110 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_FILTER_ATTR_TARGET_RANGE_ADDRESS },
1111 { XML_NAMESPACE_TABLE, XML_CONDITION_SOURCE_RANGE_ADDRESS, XML_TOK_FILTER_ATTR_CONDITION_SOURCE_RANGE_ADDRESS },
1112 { XML_NAMESPACE_TABLE, XML_CONDITION_SOURCE, XML_TOK_FILTER_ATTR_CONDITION_SOURCE },
1113 { XML_NAMESPACE_TABLE, XML_DISPLAY_DUPLICATES, XML_TOK_FILTER_ATTR_DISPLAY_DUPLICATES },
1114 XML_TOKEN_MAP_END
1115 };
1116
1117 pFilterAttrTokenMap = new SvXMLTokenMap( aFilterAttrTokenMap );
1118 } // if( !pFilterAttrTokenMap )
1119
1120 return *pFilterAttrTokenMap;
1121 }
1122
GetFilterConditionAttrTokenMap()1123 const SvXMLTokenMap& ScXMLImport::GetFilterConditionAttrTokenMap()
1124 {
1125 if( !pFilterConditionAttrTokenMap )
1126 {
1127 static __FAR_DATA SvXMLTokenMapEntry aFilterConditionAttrTokenMap[] =
1128 {
1129 { XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, XML_TOK_CONDITION_ATTR_FIELD_NUMBER },
1130 { XML_NAMESPACE_TABLE, XML_CASE_SENSITIVE, XML_TOK_CONDITION_ATTR_CASE_SENSITIVE },
1131 { XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TOK_CONDITION_ATTR_DATA_TYPE },
1132 { XML_NAMESPACE_TABLE, XML_VALUE, XML_TOK_CONDITION_ATTR_VALUE },
1133 { XML_NAMESPACE_TABLE, XML_OPERATOR, XML_TOK_CONDITION_ATTR_OPERATOR },
1134 XML_TOKEN_MAP_END
1135 };
1136
1137 pFilterConditionAttrTokenMap = new SvXMLTokenMap( aFilterConditionAttrTokenMap );
1138 } // if( !pFilterConditionAttrTokenMap )
1139
1140 return *pFilterConditionAttrTokenMap;
1141 }
1142
GetSortElemTokenMap()1143 const SvXMLTokenMap& ScXMLImport::GetSortElemTokenMap()
1144 {
1145 if( !pSortElemTokenMap )
1146 {
1147 static __FAR_DATA SvXMLTokenMapEntry aSortTokenMap[] =
1148 {
1149 { XML_NAMESPACE_TABLE, XML_SORT_BY, XML_TOK_SORT_SORT_BY },
1150 XML_TOKEN_MAP_END
1151 };
1152
1153 pSortElemTokenMap = new SvXMLTokenMap( aSortTokenMap );
1154 } // if( !pSortElemTokenMap )
1155
1156 return *pSortElemTokenMap;
1157 }
1158
GetSortAttrTokenMap()1159 const SvXMLTokenMap& ScXMLImport::GetSortAttrTokenMap()
1160 {
1161 if( !pSortAttrTokenMap )
1162 {
1163 static __FAR_DATA SvXMLTokenMapEntry aSortAttrTokenMap[] =
1164 {
1165 { XML_NAMESPACE_TABLE, XML_BIND_STYLES_TO_CONTENT, XML_TOK_SORT_ATTR_BIND_STYLES_TO_CONTENT },
1166 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_SORT_ATTR_TARGET_RANGE_ADDRESS },
1167 { XML_NAMESPACE_TABLE, XML_CASE_SENSITIVE, XML_TOK_SORT_ATTR_CASE_SENSITIVE },
1168 { XML_NAMESPACE_TABLE, XML_LANGUAGE, XML_TOK_SORT_ATTR_LANGUAGE },
1169 { XML_NAMESPACE_TABLE, XML_COUNTRY, XML_TOK_SORT_ATTR_COUNTRY },
1170 { XML_NAMESPACE_TABLE, XML_ALGORITHM, XML_TOK_SORT_ATTR_ALGORITHM },
1171 XML_TOKEN_MAP_END
1172 };
1173
1174 pSortAttrTokenMap = new SvXMLTokenMap( aSortAttrTokenMap );
1175 } // if( !pSortAttrTokenMap )
1176
1177 return *pSortAttrTokenMap;
1178 }
1179
GetSortSortByAttrTokenMap()1180 const SvXMLTokenMap& ScXMLImport::GetSortSortByAttrTokenMap()
1181 {
1182 if( !pSortSortByAttrTokenMap )
1183 {
1184 static __FAR_DATA SvXMLTokenMapEntry aSortSortByAttrTokenMap[] =
1185 {
1186 { XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, XML_TOK_SORT_BY_ATTR_FIELD_NUMBER },
1187 { XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TOK_SORT_BY_ATTR_DATA_TYPE },
1188 { XML_NAMESPACE_TABLE, XML_ORDER, XML_TOK_SORT_BY_ATTR_ORDER },
1189 XML_TOKEN_MAP_END
1190 };
1191
1192 pSortSortByAttrTokenMap = new SvXMLTokenMap( aSortSortByAttrTokenMap );
1193 } // if( !pSortSortByAttrTokenMap )
1194
1195 return *pSortSortByAttrTokenMap;
1196 }
1197
GetDatabaseRangeSubTotalRulesElemTokenMap()1198 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSubTotalRulesElemTokenMap()
1199 {
1200 if( !pDatabaseRangeSubTotalRulesElemTokenMap )
1201 {
1202 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangeSubTotalRulesTokenMap[] =
1203 {
1204 { XML_NAMESPACE_TABLE, XML_SORT_GROUPS, XML_TOK_SUBTOTAL_RULES_SORT_GROUPS },
1205 { XML_NAMESPACE_TABLE, XML_SUBTOTAL_RULE, XML_TOK_SUBTOTAL_RULES_SUBTOTAL_RULE },
1206 XML_TOKEN_MAP_END
1207 };
1208
1209 pDatabaseRangeSubTotalRulesElemTokenMap = new SvXMLTokenMap( aDatabaseRangeSubTotalRulesTokenMap );
1210 } // if( !pDatabaseRangeSubTotalRulesElemTokenMap )
1211
1212 return *pDatabaseRangeSubTotalRulesElemTokenMap;
1213 }
1214
GetDatabaseRangeSubTotalRulesAttrTokenMap()1215 const SvXMLTokenMap& ScXMLImport::GetDatabaseRangeSubTotalRulesAttrTokenMap()
1216 {
1217 if( !pDatabaseRangeSubTotalRulesAttrTokenMap )
1218 {
1219 static __FAR_DATA SvXMLTokenMapEntry aDatabaseRangeSubTotalRulesAttrTokenMap[] =
1220 {
1221 { XML_NAMESPACE_TABLE, XML_BIND_STYLES_TO_CONTENT, XML_TOK_SUBTOTAL_RULES_ATTR_BIND_STYLES_TO_CONTENT },
1222 { XML_NAMESPACE_TABLE, XML_CASE_SENSITIVE, XML_TOK_SUBTOTAL_RULES_ATTR_CASE_SENSITIVE },
1223 { XML_NAMESPACE_TABLE, XML_PAGE_BREAKS_ON_GROUP_CHANGE, XML_TOK_SUBTOTAL_RULES_ATTR_PAGE_BREAKS_ON_GROUP_CHANGE },
1224 XML_TOKEN_MAP_END
1225 };
1226
1227 pDatabaseRangeSubTotalRulesAttrTokenMap = new SvXMLTokenMap( aDatabaseRangeSubTotalRulesAttrTokenMap );
1228 } // if( !pDatabaseRangeSubTotalRulesAttrTokenMap )
1229
1230 return *pDatabaseRangeSubTotalRulesAttrTokenMap;
1231 }
1232
GetSubTotalRulesSortGroupsAttrTokenMap()1233 const SvXMLTokenMap& ScXMLImport::GetSubTotalRulesSortGroupsAttrTokenMap()
1234 {
1235 if( !pSubTotalRulesSortGroupsAttrTokenMap )
1236 {
1237 static __FAR_DATA SvXMLTokenMapEntry aSubTotalRulesSortGroupsAttrTokenMap[] =
1238 {
1239 { XML_NAMESPACE_TABLE, XML_DATA_TYPE, XML_TOK_SORT_GROUPS_ATTR_DATA_TYPE },
1240 { XML_NAMESPACE_TABLE, XML_ORDER, XML_TOK_SORT_GROUPS_ATTR_ORDER },
1241 XML_TOKEN_MAP_END
1242 };
1243
1244 pSubTotalRulesSortGroupsAttrTokenMap = new SvXMLTokenMap( aSubTotalRulesSortGroupsAttrTokenMap );
1245 } // if( !pSubTotalRulesSortGroupsAttrTokenMap )
1246
1247 return *pSubTotalRulesSortGroupsAttrTokenMap;
1248 }
1249
GetSubTotalRulesSubTotalRuleElemTokenMap()1250 const SvXMLTokenMap& ScXMLImport::GetSubTotalRulesSubTotalRuleElemTokenMap()
1251 {
1252 if( !pSubTotalRulesSubTotalRuleElemTokenMap )
1253 {
1254 static __FAR_DATA SvXMLTokenMapEntry aSubTotalRulesSubTotalRuleTokenMap[] =
1255 {
1256 { XML_NAMESPACE_TABLE, XML_SUBTOTAL_FIELD, XML_TOK_SUBTOTAL_RULE_SUBTOTAL_FIELD },
1257 XML_TOKEN_MAP_END
1258 };
1259
1260 pSubTotalRulesSubTotalRuleElemTokenMap = new SvXMLTokenMap( aSubTotalRulesSubTotalRuleTokenMap );
1261 } // if( !pSubTotalRulesSubTotalRuleElemTokenMap )
1262
1263 return *pSubTotalRulesSubTotalRuleElemTokenMap;
1264 }
1265
GetSubTotalRulesSubTotalRuleAttrTokenMap()1266 const SvXMLTokenMap& ScXMLImport::GetSubTotalRulesSubTotalRuleAttrTokenMap()
1267 {
1268 if( !pSubTotalRulesSubTotalRuleAttrTokenMap )
1269 {
1270 static __FAR_DATA SvXMLTokenMapEntry aSubTotalRulesSubTotalRuleAttrTokenMap[] =
1271 {
1272 { XML_NAMESPACE_TABLE, XML_GROUP_BY_FIELD_NUMBER, XML_TOK_SUBTOTAL_RULE_ATTR_GROUP_BY_FIELD_NUMBER },
1273 XML_TOKEN_MAP_END
1274 };
1275
1276 pSubTotalRulesSubTotalRuleAttrTokenMap = new SvXMLTokenMap( aSubTotalRulesSubTotalRuleAttrTokenMap );
1277 } // if( !pSubTotalRulesSubTotalRuleAttrTokenMap )
1278
1279 return *pSubTotalRulesSubTotalRuleAttrTokenMap;
1280 }
1281
GetSubTotalRuleSubTotalFieldAttrTokenMap()1282 const SvXMLTokenMap& ScXMLImport::GetSubTotalRuleSubTotalFieldAttrTokenMap()
1283 {
1284 if( !pSubTotalRuleSubTotalFieldAttrTokenMap )
1285 {
1286 static __FAR_DATA SvXMLTokenMapEntry aSubTotalRuleSubTotalFieldAttrTokenMap[] =
1287 {
1288 { XML_NAMESPACE_TABLE, XML_FIELD_NUMBER, XML_TOK_SUBTOTAL_FIELD_ATTR_FIELD_NUMBER },
1289 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_SUBTOTAL_FIELD_ATTR_FUNCTION },
1290 XML_TOKEN_MAP_END
1291 };
1292
1293 pSubTotalRuleSubTotalFieldAttrTokenMap = new SvXMLTokenMap( aSubTotalRuleSubTotalFieldAttrTokenMap );
1294 } // if( !pSubTotalRuleSubTotalFieldAttrTokenMap )
1295
1296 return *pSubTotalRuleSubTotalFieldAttrTokenMap;
1297 }
1298
GetDataPilotTablesElemTokenMap()1299 const SvXMLTokenMap& ScXMLImport::GetDataPilotTablesElemTokenMap()
1300 {
1301 if( !pDataPilotTablesElemTokenMap )
1302 {
1303 static __FAR_DATA SvXMLTokenMapEntry aDataPilotTablesElemTokenMap[] =
1304 {
1305 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_TABLE, XML_TOK_DATA_PILOT_TABLE },
1306 XML_TOKEN_MAP_END
1307 };
1308
1309 pDataPilotTablesElemTokenMap = new SvXMLTokenMap( aDataPilotTablesElemTokenMap );
1310 } // if( !pDataPilotTablesElemTokenMap )
1311
1312 return *pDataPilotTablesElemTokenMap;
1313 }
1314
GetDataPilotTableAttrTokenMap()1315 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableAttrTokenMap()
1316 {
1317 if( !pDataPilotTableAttrTokenMap )
1318 {
1319 static __FAR_DATA SvXMLTokenMapEntry aDataPilotTableAttrTokenMap[] =
1320 {
1321 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DATA_PILOT_TABLE_ATTR_NAME },
1322 { XML_NAMESPACE_TABLE, XML_APPLICATION_DATA, XML_TOK_DATA_PILOT_TABLE_ATTR_APPLICATION_DATA },
1323 { XML_NAMESPACE_TABLE, XML_GRAND_TOTAL, XML_TOK_DATA_PILOT_TABLE_ATTR_GRAND_TOTAL },
1324 { XML_NAMESPACE_TABLE, XML_IGNORE_EMPTY_ROWS, XML_TOK_DATA_PILOT_TABLE_ATTR_IGNORE_EMPTY_ROWS },
1325 { XML_NAMESPACE_TABLE, XML_IDENTIFY_CATEGORIES, XML_TOK_DATA_PILOT_TABLE_ATTR_IDENTIFY_CATEGORIES },
1326 { XML_NAMESPACE_TABLE, XML_TARGET_RANGE_ADDRESS, XML_TOK_DATA_PILOT_TABLE_ATTR_TARGET_RANGE_ADDRESS },
1327 { XML_NAMESPACE_TABLE, XML_BUTTONS, XML_TOK_DATA_PILOT_TABLE_ATTR_BUTTONS },
1328 { XML_NAMESPACE_TABLE, XML_SHOW_FILTER_BUTTON, XML_TOK_DATA_PILOT_TABLE_ATTR_SHOW_FILTER_BUTTON },
1329 { XML_NAMESPACE_TABLE, XML_DRILL_DOWN_ON_DOUBLE_CLICK, XML_TOK_DATA_PILOT_TABLE_ATTR_DRILL_DOWN },
1330 XML_TOKEN_MAP_END
1331 };
1332
1333 pDataPilotTableAttrTokenMap = new SvXMLTokenMap( aDataPilotTableAttrTokenMap );
1334 } // if( !pDataPilotTableAttrTokenMap )
1335
1336 return *pDataPilotTableAttrTokenMap;
1337 }
1338
GetDataPilotTableElemTokenMap()1339 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableElemTokenMap()
1340 {
1341 if( !pDataPilotTableElemTokenMap )
1342 {
1343 static __FAR_DATA SvXMLTokenMapEntry aDataPilotTableElemTokenMap[] =
1344 {
1345 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_SQL, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_SQL },
1346 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_TABLE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_TABLE },
1347 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_GRAND_TOTAL, XML_TOK_DATA_PILOT_TABLE_ELEM_GRAND_TOTAL },
1348 { XML_NAMESPACE_TABLE_EXT, XML_DATA_PILOT_GRAND_TOTAL, XML_TOK_DATA_PILOT_TABLE_ELEM_GRAND_TOTAL_EXT },
1349 { XML_NAMESPACE_TABLE, XML_DATABASE_SOURCE_QUERY, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_QUERY },
1350 { XML_NAMESPACE_TABLE, XML_SOURCE_SERVICE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_SERVICE },
1351 { XML_NAMESPACE_TABLE, XML_SOURCE_CELL_RANGE, XML_TOK_DATA_PILOT_TABLE_ELEM_SOURCE_CELL_RANGE },
1352 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_FIELD, XML_TOK_DATA_PILOT_TABLE_ELEM_DATA_PILOT_FIELD },
1353 XML_TOKEN_MAP_END
1354 };
1355
1356 pDataPilotTableElemTokenMap = new SvXMLTokenMap( aDataPilotTableElemTokenMap );
1357 } // if( !pDataPilotTableElemTokenMap )
1358
1359 return *pDataPilotTableElemTokenMap;
1360 }
1361
GetDataPilotTableSourceServiceAttrTokenMap()1362 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableSourceServiceAttrTokenMap()
1363 {
1364 if( !pDataPilotTableSourceServiceAttrTokenMap )
1365 {
1366 static __FAR_DATA SvXMLTokenMapEntry aDataPilotTableSourceServiceAttrTokenMap[] =
1367 {
1368 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_SOURCE_SERVICE_ATTR_NAME },
1369 { XML_NAMESPACE_TABLE, XML_SOURCE_NAME, XML_TOK_SOURCE_SERVICE_ATTR_SOURCE_NAME },
1370 { XML_NAMESPACE_TABLE, XML_OBJECT_NAME, XML_TOK_SOURCE_SERVICE_ATTR_OBJECT_NAME },
1371 { XML_NAMESPACE_TABLE, XML_USER_NAME, XML_TOK_SOURCE_SERVICE_ATTR_USER_NAME },
1372 { XML_NAMESPACE_TABLE, XML_PASSWORD, XML_TOK_SOURCE_SERVICE_ATTR_PASSWORD },
1373 XML_TOKEN_MAP_END
1374 };
1375
1376 pDataPilotTableSourceServiceAttrTokenMap = new SvXMLTokenMap( aDataPilotTableSourceServiceAttrTokenMap );
1377 } // if( !pDataPilotTableSourceServiceAttrTokenMap )
1378
1379 return *pDataPilotTableSourceServiceAttrTokenMap;
1380 }
1381
GetDataPilotGrandTotalAttrTokenMap()1382 const SvXMLTokenMap& ScXMLImport::GetDataPilotGrandTotalAttrTokenMap()
1383 {
1384 if (!pDataPilotGrandTotalAttrTokenMap)
1385 {
1386 static __FAR_DATA SvXMLTokenMapEntry aDataPilotGrandTotalAttrTokenMap[] =
1387 {
1388 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_DATA_PILOT_GRAND_TOTAL_ATTR_DISPLAY },
1389 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_DATA_PILOT_GRAND_TOTAL_ATTR_ORIENTATION },
1390 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_GRAND_TOTAL_ATTR_DISPLAY_NAME },
1391 { XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_GRAND_TOTAL_ATTR_DISPLAY_NAME_EXT },
1392 XML_TOKEN_MAP_END
1393 };
1394
1395 pDataPilotGrandTotalAttrTokenMap = new SvXMLTokenMap( aDataPilotGrandTotalAttrTokenMap );
1396 }
1397
1398 return *pDataPilotGrandTotalAttrTokenMap;
1399 }
1400
GetDataPilotTableSourceCellRangeAttrTokenMap()1401 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableSourceCellRangeAttrTokenMap()
1402 {
1403 if( !pDataPilotTableSourceCellRangeAttrTokenMap )
1404 {
1405 static __FAR_DATA SvXMLTokenMapEntry aDataPilotTableSourceCellRangeAttrTokenMap[] =
1406 {
1407 { XML_NAMESPACE_TABLE, XML_CELL_RANGE_ADDRESS, XML_TOK_SOURCE_CELL_RANGE_ATTR_CELL_RANGE_ADDRESS},
1408 XML_TOKEN_MAP_END
1409 };
1410
1411 pDataPilotTableSourceCellRangeAttrTokenMap = new SvXMLTokenMap( aDataPilotTableSourceCellRangeAttrTokenMap );
1412 } // if( !pDataPilotTableSourceCellRangeAttrTokenMap )
1413
1414 return *pDataPilotTableSourceCellRangeAttrTokenMap;
1415 }
1416
GetDataPilotTableSourceCellRangeElemTokenMap()1417 const SvXMLTokenMap& ScXMLImport::GetDataPilotTableSourceCellRangeElemTokenMap()
1418 {
1419 if( !pDataPilotTableSourceCellRangeElemTokenMap )
1420 {
1421 static __FAR_DATA SvXMLTokenMapEntry aDataPilotTableSourceCellRangeElemTokenMap[] =
1422 {
1423 { XML_NAMESPACE_TABLE, XML_FILTER, XML_TOK_SOURCE_CELL_RANGE_ELEM_FILTER},
1424 XML_TOKEN_MAP_END
1425 };
1426
1427 pDataPilotTableSourceCellRangeElemTokenMap = new SvXMLTokenMap( aDataPilotTableSourceCellRangeElemTokenMap );
1428 } // if( !pDataPilotTableSourceCellRangeElemTokenMap )
1429
1430 return *pDataPilotTableSourceCellRangeElemTokenMap;
1431 }
1432
GetDataPilotFieldAttrTokenMap()1433 const SvXMLTokenMap& ScXMLImport::GetDataPilotFieldAttrTokenMap()
1434 {
1435 if( !pDataPilotFieldAttrTokenMap )
1436 {
1437 static __FAR_DATA SvXMLTokenMapEntry aDataPilotFieldAttrTokenMap[] =
1438 {
1439 { XML_NAMESPACE_TABLE, XML_SOURCE_FIELD_NAME, XML_TOK_DATA_PILOT_FIELD_ATTR_SOURCE_FIELD_NAME },
1440 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_FIELD_ATTR_DISPLAY_NAME },
1441 { XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_FIELD_ATTR_DISPLAY_NAME_EXT },
1442 { XML_NAMESPACE_TABLE, XML_IS_DATA_LAYOUT_FIELD, XML_TOK_DATA_PILOT_FIELD_ATTR_IS_DATA_LAYOUT_FIELD },
1443 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_DATA_PILOT_FIELD_ATTR_FUNCTION },
1444 { XML_NAMESPACE_TABLE, XML_ORIENTATION, XML_TOK_DATA_PILOT_FIELD_ATTR_ORIENTATION },
1445 { XML_NAMESPACE_TABLE, XML_SELECTED_PAGE, XML_TOK_DATA_PILOT_FIELD_ATTR_SELECTED_PAGE },
1446 { XML_NAMESPACE_TABLE, XML_USED_HIERARCHY, XML_TOK_DATA_PILOT_FIELD_ATTR_USED_HIERARCHY },
1447 XML_TOKEN_MAP_END
1448 };
1449
1450 pDataPilotFieldAttrTokenMap = new SvXMLTokenMap( aDataPilotFieldAttrTokenMap );
1451 } // if( !pDataPilotFieldAttrTokenMap )
1452
1453 return *pDataPilotFieldAttrTokenMap;
1454 }
1455
GetDataPilotFieldElemTokenMap()1456 const SvXMLTokenMap& ScXMLImport::GetDataPilotFieldElemTokenMap()
1457 {
1458 if( !pDataPilotFieldElemTokenMap )
1459 {
1460 static __FAR_DATA SvXMLTokenMapEntry aDataPilotFieldElemTokenMap[] =
1461 {
1462 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_LEVEL, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_LEVEL },
1463 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_FIELD_REFERENCE, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_REFERENCE },
1464 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_GROUPS, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_GROUPS },
1465 XML_TOKEN_MAP_END
1466 };
1467
1468 pDataPilotFieldElemTokenMap = new SvXMLTokenMap( aDataPilotFieldElemTokenMap );
1469 } // if( !pDataPilotFieldElemTokenMap )
1470
1471 return *pDataPilotFieldElemTokenMap;
1472 }
1473
GetDataPilotLevelAttrTokenMap()1474 const SvXMLTokenMap& ScXMLImport::GetDataPilotLevelAttrTokenMap()
1475 {
1476 if( !pDataPilotLevelAttrTokenMap )
1477 {
1478 static __FAR_DATA SvXMLTokenMapEntry aDataPilotLevelAttrTokenMap[] =
1479 {
1480 { XML_NAMESPACE_TABLE, XML_SHOW_EMPTY, XML_TOK_DATA_PILOT_LEVEL_ATTR_SHOW_EMPTY },
1481 XML_TOKEN_MAP_END
1482 };
1483
1484 pDataPilotLevelAttrTokenMap = new SvXMLTokenMap( aDataPilotLevelAttrTokenMap );
1485 } // if( !pDataPilotLevelAttrTokenMap )
1486
1487 return *pDataPilotLevelAttrTokenMap;
1488 }
1489
GetDataPilotLevelElemTokenMap()1490 const SvXMLTokenMap& ScXMLImport::GetDataPilotLevelElemTokenMap()
1491 {
1492 if( !pDataPilotLevelElemTokenMap )
1493 {
1494 static __FAR_DATA SvXMLTokenMapEntry aDataPilotLevelElemTokenMap[] =
1495 {
1496 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_SUBTOTALS, XML_TOK_DATA_PILOT_LEVEL_ELEM_DATA_PILOT_SUBTOTALS },
1497 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_MEMBERS, XML_TOK_DATA_PILOT_LEVEL_ELEM_DATA_PILOT_MEMBERS },
1498 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_DISPLAY_INFO, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_DISPLAY_INFO },
1499 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_SORT_INFO, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_SORT_INFO },
1500 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_LAYOUT_INFO, XML_TOK_DATA_PILOT_FIELD_ELEM_DATA_PILOT_LAYOUT_INFO },
1501 XML_TOKEN_MAP_END
1502 };
1503
1504 pDataPilotLevelElemTokenMap = new SvXMLTokenMap( aDataPilotLevelElemTokenMap );
1505 } // if( !pDataPilotLevelElemTokenMap )
1506
1507 return *pDataPilotLevelElemTokenMap;
1508 }
1509
GetDataPilotSubTotalsElemTokenMap()1510 const SvXMLTokenMap& ScXMLImport::GetDataPilotSubTotalsElemTokenMap()
1511 {
1512 if( !pDataPilotSubTotalsElemTokenMap )
1513 {
1514 static __FAR_DATA SvXMLTokenMapEntry aDataPilotSubTotalsElemTokenMap[] =
1515 {
1516 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_SUBTOTAL, XML_TOK_DATA_PILOT_SUBTOTALS_ELEM_DATA_PILOT_SUBTOTAL },
1517 XML_TOKEN_MAP_END
1518 };
1519
1520 pDataPilotSubTotalsElemTokenMap = new SvXMLTokenMap( aDataPilotSubTotalsElemTokenMap );
1521 } // if( !pDataPilotSubTotalsElemTokenMap )
1522
1523 return *pDataPilotSubTotalsElemTokenMap;
1524 }
1525
GetDataPilotSubTotalAttrTokenMap()1526 const SvXMLTokenMap& ScXMLImport::GetDataPilotSubTotalAttrTokenMap()
1527 {
1528 if( !pDataPilotSubTotalAttrTokenMap )
1529 {
1530 static __FAR_DATA SvXMLTokenMapEntry aDataPilotSubTotalAttrTokenMap[] =
1531 {
1532 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_DATA_PILOT_SUBTOTAL_ATTR_FUNCTION },
1533 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_SUBTOTAL_ATTR_DISPLAY_NAME },
1534 { XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_SUBTOTAL_ATTR_DISPLAY_NAME_EXT },
1535 XML_TOKEN_MAP_END
1536 };
1537
1538 pDataPilotSubTotalAttrTokenMap = new SvXMLTokenMap( aDataPilotSubTotalAttrTokenMap );
1539 } // if( !pDataPilotSubTotalAttrTokenMap )
1540
1541 return *pDataPilotSubTotalAttrTokenMap;
1542 }
1543
GetDataPilotMembersElemTokenMap()1544 const SvXMLTokenMap& ScXMLImport::GetDataPilotMembersElemTokenMap()
1545 {
1546 if( !pDataPilotMembersElemTokenMap )
1547 {
1548 static __FAR_DATA SvXMLTokenMapEntry aDataPilotMembersElemTokenMap[] =
1549 {
1550 { XML_NAMESPACE_TABLE, XML_DATA_PILOT_MEMBER, XML_TOK_DATA_PILOT_MEMBERS_ELEM_DATA_PILOT_MEMBER },
1551 XML_TOKEN_MAP_END
1552 };
1553
1554 pDataPilotMembersElemTokenMap = new SvXMLTokenMap( aDataPilotMembersElemTokenMap );
1555 } // if( !pDataPilotMembersElemTokenMap )
1556
1557 return *pDataPilotMembersElemTokenMap;
1558 }
1559
GetDataPilotMemberAttrTokenMap()1560 const SvXMLTokenMap& ScXMLImport::GetDataPilotMemberAttrTokenMap()
1561 {
1562 if( !pDataPilotMemberAttrTokenMap )
1563 {
1564 static __FAR_DATA SvXMLTokenMapEntry aDataPilotMemberAttrTokenMap[] =
1565 {
1566 { XML_NAMESPACE_TABLE, XML_NAME, XML_TOK_DATA_PILOT_MEMBER_ATTR_NAME },
1567 { XML_NAMESPACE_TABLE, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_MEMBER_ATTR_DISPLAY_NAME },
1568 { XML_NAMESPACE_TABLE_EXT, XML_DISPLAY_NAME, XML_TOK_DATA_PILOT_MEMBER_ATTR_DISPLAY_NAME_EXT },
1569 { XML_NAMESPACE_TABLE, XML_DISPLAY, XML_TOK_DATA_PILOT_MEMBER_ATTR_DISPLAY },
1570 { XML_NAMESPACE_TABLE, XML_SHOW_DETAILS, XML_TOK_DATA_PILOT_MEMBER_ATTR_SHOW_DETAILS },
1571 XML_TOKEN_MAP_END
1572 };
1573
1574 pDataPilotMemberAttrTokenMap = new SvXMLTokenMap( aDataPilotMemberAttrTokenMap );
1575 } // if( !pDataPilotMemberAttrTokenMap )
1576
1577 return *pDataPilotMemberAttrTokenMap;
1578 }
1579
GetConsolidationAttrTokenMap()1580 const SvXMLTokenMap& ScXMLImport::GetConsolidationAttrTokenMap()
1581 {
1582 if( !pConsolidationAttrTokenMap )
1583 {
1584 static __FAR_DATA SvXMLTokenMapEntry aConsolidationAttrTokenMap[] =
1585 {
1586 { XML_NAMESPACE_TABLE, XML_FUNCTION, XML_TOK_CONSOLIDATION_ATTR_FUNCTION },
1587 { XML_NAMESPACE_TABLE, XML_SOURCE_CELL_RANGE_ADDRESSES, XML_TOK_CONSOLIDATION_ATTR_SOURCE_RANGES },
1588 { XML_NAMESPACE_TABLE, XML_TARGET_CELL_ADDRESS, XML_TOK_CONSOLIDATION_ATTR_TARGET_ADDRESS },
1589 { XML_NAMESPACE_TABLE, XML_USE_LABEL, XML_TOK_CONSOLIDATION_ATTR_USE_LABEL },
1590 { XML_NAMESPACE_TABLE, XML_LINK_TO_SOURCE_DATA, XML_TOK_CONSOLIDATION_ATTR_LINK_TO_SOURCE },
1591 XML_TOKEN_MAP_END
1592 };
1593
1594 pConsolidationAttrTokenMap = new SvXMLTokenMap( aConsolidationAttrTokenMap );
1595 } // if( !pConsolidationAttrTokenMap )
1596
1597 return *pConsolidationAttrTokenMap;
1598 }
1599
1600
CreateContext(sal_uInt16 nPrefix,const OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList)1601 SvXMLImportContext *ScXMLImport::CreateContext( sal_uInt16 nPrefix,
1602 const OUString& rLocalName,
1603 const uno::Reference<xml::sax::XAttributeList>& xAttrList )
1604 {
1605 SvXMLImportContext *pContext = 0;
1606
1607 if( (XML_NAMESPACE_OFFICE == nPrefix) &&
1608 ( IsXMLToken(rLocalName, XML_DOCUMENT_STYLES) ||
1609 IsXMLToken(rLocalName, XML_DOCUMENT_CONTENT) ||
1610 IsXMLToken(rLocalName, XML_DOCUMENT_SETTINGS) )) {
1611 pContext = new ScXMLDocContext_Impl( *this, nPrefix, rLocalName,
1612 xAttrList );
1613 } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
1614 ( IsXMLToken(rLocalName, XML_DOCUMENT_META)) ) {
1615 pContext = CreateMetaContext(rLocalName);
1616 } else if ( (XML_NAMESPACE_OFFICE == nPrefix) &&
1617 ( IsXMLToken(rLocalName, XML_DOCUMENT)) ) {
1618 uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
1619 mxServiceFactory->createInstance(::rtl::OUString::createFromAscii(
1620 "com.sun.star.xml.dom.SAXDocumentBuilder")),
1621 uno::UNO_QUERY_THROW);
1622 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1623 GetModel(), uno::UNO_QUERY_THROW);
1624 // flat OpenDocument file format
1625 pContext = new ScXMLFlatDocContext_Impl( *this, nPrefix, rLocalName,
1626 xAttrList, xDPS->getDocumentProperties(), xDocBuilder);
1627 }
1628 else
1629 pContext = SvXMLImport::CreateContext( nPrefix, rLocalName, xAttrList );
1630
1631 return pContext;
1632 }
1633
1634 // #110680#
ScXMLImport(const::com::sun::star::uno::Reference<::com::sun::star::lang::XMultiServiceFactory> xServiceFactory,const sal_uInt16 nImportFlag)1635 ScXMLImport::ScXMLImport(
1636 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xServiceFactory,
1637 const sal_uInt16 nImportFlag)
1638 : SvXMLImport( xServiceFactory, nImportFlag ),
1639 pDoc( NULL ),
1640 pChangeTrackingImportHelper(NULL),
1641 pStylesImportHelper(NULL),
1642 sNumberFormat(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_NUMFMT)),
1643 sLocale(RTL_CONSTASCII_USTRINGPARAM(SC_LOCALE)),
1644 sCellStyle(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLSTYL)),
1645 sStandardFormat(RTL_CONSTASCII_USTRINGPARAM(SC_STANDARDFORMAT)),
1646 sType(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_TYPE)),
1647 // pScAutoStylePool(new SvXMLAutoStylePoolP),
1648 // pParaItemMapper( 0 ),
1649 // pI18NMap( new SvI18NMap ),
1650 pDocElemTokenMap( 0 ),
1651 pStylesElemTokenMap( 0 ),
1652 pStylesAttrTokenMap( 0 ),
1653 pStyleElemTokenMap( 0 ),
1654 pBodyElemTokenMap( 0 ),
1655 pContentValidationsElemTokenMap( 0 ),
1656 pContentValidationElemTokenMap( 0 ),
1657 pContentValidationAttrTokenMap( 0 ),
1658 pContentValidationMessageElemTokenMap( 0 ),
1659 pContentValidationHelpMessageAttrTokenMap( 0 ),
1660 pContentValidationErrorMessageAttrTokenMap( 0 ),
1661 pContentValidationErrorMacroAttrTokenMap( 0 ),
1662 pLabelRangesElemTokenMap( 0 ),
1663 pLabelRangeAttrTokenMap( 0 ),
1664 pTableElemTokenMap( 0 ),
1665 pTableRowsElemTokenMap( 0 ),
1666 pTableColsElemTokenMap( 0 ),
1667 pTableScenarioAttrTokenMap( 0 ),
1668 pTableAttrTokenMap( 0 ),
1669 pTableColAttrTokenMap( 0 ),
1670 pTableRowElemTokenMap( 0 ),
1671 pTableRowAttrTokenMap( 0 ),
1672 pTableRowCellElemTokenMap( 0 ),
1673 pTableRowCellAttrTokenMap( 0 ),
1674 pTableAnnotationAttrTokenMap( 0 ),
1675 pDetectiveElemTokenMap( 0 ),
1676 pDetectiveHighlightedAttrTokenMap( 0 ),
1677 pDetectiveOperationAttrTokenMap( 0 ),
1678 pTableCellRangeSourceAttrTokenMap( 0 ),
1679 pNamedExpressionsElemTokenMap( 0 ),
1680 pNamedRangeAttrTokenMap( 0 ),
1681 pNamedExpressionAttrTokenMap( 0 ),
1682 pDatabaseRangesElemTokenMap( 0 ),
1683 pDatabaseRangeElemTokenMap( 0 ),
1684 pDatabaseRangeAttrTokenMap( 0 ),
1685 pDatabaseRangeSourceSQLAttrTokenMap( 0 ),
1686 pDatabaseRangeSourceTableAttrTokenMap( 0 ),
1687 pDatabaseRangeSourceQueryAttrTokenMap( 0 ),
1688 pFilterElemTokenMap( 0 ),
1689 pFilterAttrTokenMap( 0 ),
1690 pFilterConditionAttrTokenMap( 0 ),
1691 pSortElemTokenMap( 0 ),
1692 pSortAttrTokenMap( 0 ),
1693 pSortSortByAttrTokenMap( 0 ),
1694 pDatabaseRangeSubTotalRulesElemTokenMap( 0 ),
1695 pDatabaseRangeSubTotalRulesAttrTokenMap( 0 ),
1696 pSubTotalRulesSortGroupsAttrTokenMap( 0 ),
1697 pSubTotalRulesSubTotalRuleElemTokenMap( 0 ),
1698 pSubTotalRulesSubTotalRuleAttrTokenMap( 0 ),
1699 pSubTotalRuleSubTotalFieldAttrTokenMap( 0 ),
1700 pDataPilotTablesElemTokenMap( 0 ),
1701 pDataPilotTableAttrTokenMap( 0 ),
1702 pDataPilotTableElemTokenMap( 0 ),
1703 pDataPilotTableSourceServiceAttrTokenMap( 0 ),
1704 pDataPilotGrandTotalAttrTokenMap(NULL),
1705 pDataPilotTableSourceCellRangeElemTokenMap( 0 ),
1706 pDataPilotTableSourceCellRangeAttrTokenMap( 0 ),
1707 pDataPilotFieldAttrTokenMap( 0 ),
1708 pDataPilotFieldElemTokenMap( 0 ),
1709 pDataPilotLevelAttrTokenMap( 0 ),
1710 pDataPilotLevelElemTokenMap( 0 ),
1711 pDataPilotSubTotalsElemTokenMap( 0 ),
1712 pDataPilotSubTotalAttrTokenMap( 0 ),
1713 pDataPilotMembersElemTokenMap( 0 ),
1714 pDataPilotMemberAttrTokenMap( 0 ),
1715 pConsolidationAttrTokenMap( 0 ),
1716 aTables(*this),
1717 pMyNamedExpressions(NULL),
1718 pMyLabelRanges(NULL),
1719 pValidations(NULL),
1720 pDetectiveOpArray(NULL),
1721 pScUnoGuard(NULL),
1722 pNumberFormatAttributesExportHelper(NULL),
1723 pStyleNumberFormats(NULL),
1724 sPrevStyleName(),
1725 sPrevCurrency(),
1726 nSolarMutexLocked(0),
1727 nProgressCount(0),
1728 nStyleFamilyMask( 0 ),
1729 nPrevCellType(0),
1730 bLoadDoc( sal_True ),
1731 bRemoveLastChar(sal_False),
1732 bNullDateSetted(sal_False),
1733 bSelfImportingXMLSet(sal_False),
1734 bLatinDefaultStyle(sal_False),
1735 bFromWrapper(sal_False)
1736 {
1737 pStylesImportHelper = new ScMyStylesImportHelper(*this);
1738
1739 xScPropHdlFactory = new XMLScPropHdlFactory;
1740 xCellStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScCellStylesProperties, xScPropHdlFactory);
1741 xColumnStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScColumnStylesProperties, xScPropHdlFactory);
1742 xRowStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScRowStylesImportProperties, xScPropHdlFactory);
1743 xTableStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScTableStylesImportProperties, xScPropHdlFactory);
1744
1745 // #i66550# needed for 'presentation:event-listener' element for URLs in shapes
1746 GetNamespaceMap().Add(
1747 GetXMLToken( XML_NP_PRESENTATION ),
1748 GetXMLToken( XML_N_PRESENTATION ),
1749 XML_NAMESPACE_PRESENTATION );
1750
1751 // initialize cell type map.
1752 const struct { XMLTokenEnum _token; sal_Int16 _type; } aCellTypePairs[] =
1753 {
1754 { XML_FLOAT, util::NumberFormat::NUMBER },
1755 { XML_STRING, util::NumberFormat::TEXT },
1756 { XML_TIME, util::NumberFormat::TIME },
1757 { XML_DATE, util::NumberFormat::DATETIME },
1758 { XML_PERCENTAGE, util::NumberFormat::PERCENT },
1759 { XML_CURRENCY, util::NumberFormat::CURRENCY },
1760 { XML_BOOLEAN, util::NumberFormat::LOGICAL }
1761 };
1762 size_t n = sizeof(aCellTypePairs)/sizeof(aCellTypePairs[0]);
1763 for (size_t i = 0; i < n; ++i)
1764 {
1765 aCellTypeMap.insert(
1766 CellTypeMap::value_type(
1767 GetXMLToken(aCellTypePairs[i]._token), aCellTypePairs[i]._type));
1768 }
1769 }
1770
~ScXMLImport()1771 ScXMLImport::~ScXMLImport() throw()
1772 {
1773 // delete pI18NMap;
1774 delete pDocElemTokenMap;
1775 delete pStylesElemTokenMap;
1776 delete pStylesAttrTokenMap;
1777 delete pStyleElemTokenMap;
1778 delete pBodyElemTokenMap;
1779 delete pContentValidationsElemTokenMap;
1780 delete pContentValidationElemTokenMap;
1781 delete pContentValidationAttrTokenMap;
1782 delete pContentValidationMessageElemTokenMap;
1783 delete pContentValidationHelpMessageAttrTokenMap;
1784 delete pContentValidationErrorMessageAttrTokenMap;
1785 delete pContentValidationErrorMacroAttrTokenMap;
1786 delete pLabelRangesElemTokenMap;
1787 delete pLabelRangeAttrTokenMap;
1788 delete pTableElemTokenMap;
1789 delete pTableRowsElemTokenMap;
1790 delete pTableColsElemTokenMap;
1791 delete pTableAttrTokenMap;
1792 delete pTableScenarioAttrTokenMap;
1793 delete pTableColAttrTokenMap;
1794 delete pTableRowElemTokenMap;
1795 delete pTableRowAttrTokenMap;
1796 delete pTableRowCellElemTokenMap;
1797 delete pTableRowCellAttrTokenMap;
1798 delete pTableAnnotationAttrTokenMap;
1799 delete pDetectiveElemTokenMap;
1800 delete pDetectiveHighlightedAttrTokenMap;
1801 delete pDetectiveOperationAttrTokenMap;
1802 delete pTableCellRangeSourceAttrTokenMap;
1803 delete pNamedExpressionsElemTokenMap;
1804 delete pNamedRangeAttrTokenMap;
1805 delete pNamedExpressionAttrTokenMap;
1806 delete pDatabaseRangesElemTokenMap;
1807 delete pDatabaseRangeElemTokenMap;
1808 delete pDatabaseRangeAttrTokenMap;
1809 delete pDatabaseRangeSourceSQLAttrTokenMap;
1810 delete pDatabaseRangeSourceTableAttrTokenMap;
1811 delete pDatabaseRangeSourceQueryAttrTokenMap;
1812 delete pFilterElemTokenMap;
1813 delete pFilterAttrTokenMap;
1814 delete pFilterConditionAttrTokenMap;
1815 delete pSortElemTokenMap;
1816 delete pSortAttrTokenMap;
1817 delete pSortSortByAttrTokenMap;
1818 delete pDatabaseRangeSubTotalRulesElemTokenMap;
1819 delete pDatabaseRangeSubTotalRulesAttrTokenMap;
1820 delete pSubTotalRulesSortGroupsAttrTokenMap;
1821 delete pSubTotalRulesSubTotalRuleElemTokenMap;
1822 delete pSubTotalRulesSubTotalRuleAttrTokenMap;
1823 delete pSubTotalRuleSubTotalFieldAttrTokenMap;
1824 delete pDataPilotTablesElemTokenMap;
1825 delete pDataPilotTableAttrTokenMap;
1826 delete pDataPilotTableElemTokenMap;
1827 delete pDataPilotTableSourceServiceAttrTokenMap;
1828 delete pDataPilotTableSourceCellRangeAttrTokenMap;
1829 delete pDataPilotTableSourceCellRangeElemTokenMap;
1830 delete pDataPilotFieldAttrTokenMap;
1831 delete pDataPilotFieldElemTokenMap;
1832 delete pDataPilotLevelAttrTokenMap;
1833 delete pDataPilotLevelElemTokenMap;
1834 delete pDataPilotSubTotalsElemTokenMap;
1835 delete pDataPilotSubTotalAttrTokenMap;
1836 delete pDataPilotMembersElemTokenMap;
1837 delete pDataPilotMemberAttrTokenMap;
1838 delete pConsolidationAttrTokenMap;
1839
1840 // if (pScAutoStylePool)
1841 // delete pScAutoStylePool;
1842 if (pChangeTrackingImportHelper)
1843 delete pChangeTrackingImportHelper;
1844 if (pNumberFormatAttributesExportHelper)
1845 delete pNumberFormatAttributesExportHelper;
1846 if (pStyleNumberFormats)
1847 delete pStyleNumberFormats;
1848 if (pStylesImportHelper)
1849 delete pStylesImportHelper;
1850
1851 if (pScUnoGuard)
1852 delete pScUnoGuard;
1853
1854 if (pMyNamedExpressions)
1855 delete pMyNamedExpressions;
1856 if (pMyLabelRanges)
1857 delete pMyLabelRanges;
1858 if (pValidations)
1859 delete pValidations;
1860 if (pDetectiveOpArray)
1861 delete pDetectiveOpArray;
1862 }
1863
1864 // ---------------------------------------------------------------------
1865
CreateFontDeclsContext(const sal_uInt16 nPrefix,const::rtl::OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList)1866 SvXMLImportContext *ScXMLImport::CreateFontDeclsContext(const sal_uInt16 nPrefix, const ::rtl::OUString& rLocalName,
1867 const uno::Reference<xml::sax::XAttributeList>& xAttrList)
1868 {
1869 SvXMLImportContext *pContext = NULL;
1870 if (!pContext)
1871 {
1872 XMLFontStylesContext *pFSContext(
1873 new XMLFontStylesContext( *this, nPrefix,
1874 rLocalName, xAttrList,
1875 gsl_getSystemTextEncoding() ));
1876 SetFontDecls( pFSContext );
1877 pContext = pFSContext;
1878 }
1879 return pContext;
1880 }
1881
CreateStylesContext(const::rtl::OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList,sal_Bool bIsAutoStyle)1882 SvXMLImportContext *ScXMLImport::CreateStylesContext(const ::rtl::OUString& rLocalName,
1883 const uno::Reference<xml::sax::XAttributeList>& xAttrList, sal_Bool bIsAutoStyle )
1884 {
1885 SvXMLImportContext *pContext(NULL);
1886 if (!pContext)
1887 {
1888 pContext = new XMLTableStylesContext(*this, XML_NAMESPACE_OFFICE, rLocalName, xAttrList, bIsAutoStyle);
1889 if (bIsAutoStyle)
1890 //xAutoStyles = pContext;
1891 SetAutoStyles((SvXMLStylesContext*)pContext);
1892 else
1893 //xStyles = pContext;
1894 SetStyles((SvXMLStylesContext*)pContext);
1895 }
1896 return pContext;
1897 }
1898
CreateBodyContext(const::rtl::OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList)1899 SvXMLImportContext *ScXMLImport::CreateBodyContext(const ::rtl::OUString& rLocalName,
1900 const uno::Reference<xml::sax::XAttributeList>& xAttrList)
1901 {
1902 //GetShapeImport()->SetAutoStylesContext((XMLTableStylesContext *)&xAutoStyles);
1903 //GetChartImport()->SetAutoStylesContext(GetAutoStyles()/*(XMLTableStylesContext *)&xAutoStyles*/);
1904
1905 return new ScXMLBodyContext(*this, XML_NAMESPACE_OFFICE, rLocalName, xAttrList);
1906 }
1907
CreateMetaContext(const OUString & rLocalName)1908 SvXMLImportContext *ScXMLImport::CreateMetaContext(
1909 const OUString& rLocalName )
1910 {
1911 SvXMLImportContext *pContext(0);
1912
1913 if (getImportFlags() & IMPORT_META)
1914 {
1915 uno::Reference<xml::sax::XDocumentHandler> xDocBuilder(
1916 mxServiceFactory->createInstance(::rtl::OUString::createFromAscii(
1917 "com.sun.star.xml.dom.SAXDocumentBuilder")),
1918 uno::UNO_QUERY_THROW);
1919 uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
1920 GetModel(), uno::UNO_QUERY_THROW);
1921 uno::Reference<document::XDocumentProperties> const xDocProps(
1922 (IsStylesOnlyMode()) ? 0 : xDPS->getDocumentProperties());
1923 pContext = new SvXMLMetaDocumentContext(*this,
1924 XML_NAMESPACE_OFFICE, rLocalName,
1925 xDocProps, xDocBuilder);
1926 }
1927
1928 if( !pContext )
1929 pContext = new SvXMLImportContext( *this,
1930 XML_NAMESPACE_OFFICE, rLocalName );
1931
1932 return pContext;
1933 }
1934
CreateScriptContext(const OUString & rLocalName)1935 SvXMLImportContext *ScXMLImport::CreateScriptContext(
1936 const OUString& rLocalName )
1937 {
1938 SvXMLImportContext *pContext(0);
1939
1940 if( !(IsStylesOnlyMode()) )
1941 {
1942 pContext = new XMLScriptContext( *this,
1943 XML_NAMESPACE_OFFICE, rLocalName,
1944 GetModel() );
1945 }
1946
1947 if( !pContext )
1948 pContext = new SvXMLImportContext( *this, XML_NAMESPACE_OFFICE,
1949 rLocalName );
1950
1951 return pContext;
1952 }
1953
SetStatistics(const uno::Sequence<beans::NamedValue> & i_rStats)1954 void ScXMLImport::SetStatistics(
1955 const uno::Sequence<beans::NamedValue> & i_rStats)
1956 {
1957 static const char* s_stats[] =
1958 { "TableCount", "CellCount", "ObjectCount", 0 };
1959
1960 SvXMLImport::SetStatistics(i_rStats);
1961
1962 sal_uInt32 nCount(0);
1963 for (sal_Int32 i = 0; i < i_rStats.getLength(); ++i) {
1964 for (const char** pStat = s_stats; *pStat != 0; ++pStat) {
1965 if (i_rStats[i].Name.equalsAscii(*pStat)) {
1966 sal_Int32 val = 0;
1967 if (i_rStats[i].Value >>= val) {
1968 nCount += val;
1969 } else {
1970 DBG_ERROR("ScXMLImport::SetStatistics: invalid entry");
1971 }
1972 }
1973 }
1974 }
1975
1976 if (nCount)
1977 {
1978 GetProgressBarHelper()->SetReference(nCount);
1979 GetProgressBarHelper()->SetValue(0);
1980 }
1981 }
1982
GetCellType(const OUString & rStrValue) const1983 sal_Int16 ScXMLImport::GetCellType(const OUString& rStrValue) const
1984 {
1985 CellTypeMap::const_iterator itr = aCellTypeMap.find(rStrValue);
1986 if (itr != aCellTypeMap.end())
1987 return itr->second;
1988
1989 return util::NumberFormat::UNDEFINED;
1990 }
1991
CreateShapeImport()1992 XMLShapeImportHelper* ScXMLImport::CreateShapeImport()
1993 {
1994 /*UniReference < XMLPropertySetMapper > xShapeStylesPropertySetMapper = new XMLPropertySetMapper((XMLPropertyMapEntry*)aXMLScShapeStylesProperties, xScPropHdlFactory);
1995 SvXMLImportPropertyMapper *pShapeStylesImportPropertySetMapper = new SvXMLImportPropertyMapper( xShapeStylesPropertySetMapper );*/
1996
1997 return new XMLTableShapeImportHelper( *this/*, pShapeStylesImportPropertySetMapper*/ );
1998 }
1999
GetValidation(const rtl::OUString & sName,ScMyImportValidation & aValidation)2000 sal_Bool ScXMLImport::GetValidation(const rtl::OUString& sName, ScMyImportValidation& aValidation)
2001 {
2002 if (pValidations)
2003 {
2004 sal_Bool bFound(sal_False);
2005 ScMyImportValidations::iterator aItr(pValidations->begin());
2006 ScMyImportValidations::iterator aEndItr(pValidations->end());
2007 while(aItr != aEndItr && !bFound)
2008 {
2009 if (aItr->sName == sName)
2010 {
2011 // #b4974740# source position must be set as string,
2012 // so sBaseCellAddress no longer has to be converted here
2013
2014 bFound = sal_True;
2015 }
2016 else
2017 ++aItr;
2018 }
2019 if (bFound)
2020 aValidation = *aItr;
2021 return bFound;
2022 }
2023 return sal_False;
2024 }
2025
GetChangeTrackingImportHelper()2026 ScXMLChangeTrackingImportHelper* ScXMLImport::GetChangeTrackingImportHelper()
2027 {
2028 if (!pChangeTrackingImportHelper)
2029 pChangeTrackingImportHelper = new ScXMLChangeTrackingImportHelper();
2030 return pChangeTrackingImportHelper;
2031 }
2032
InsertStyles()2033 void ScXMLImport::InsertStyles()
2034 {
2035 GetStyles()->CopyStylesToDoc(sal_True);
2036
2037 // if content is going to be loaded with the same import, set bLatinDefaultStyle flag now
2038 if ( getImportFlags() & IMPORT_CONTENT )
2039 ExamineDefaultStyle();
2040 }
2041
ExamineDefaultStyle()2042 void ScXMLImport::ExamineDefaultStyle()
2043 {
2044 if (pDoc)
2045 {
2046 // #i62435# after inserting the styles, check if the default style has a latin-script-only
2047 // number format (then, value cells can be pre-initialized with western script type)
2048
2049 const ScPatternAttr* pDefPattern = pDoc->GetDefPattern();
2050 SvNumberFormatter* pFormatter = pDoc->GetFormatTable();
2051 if ( pFormatter && pDefPattern )
2052 {
2053 sal_uInt32 nKey = pDefPattern->GetNumberFormat(pFormatter);
2054 const SvNumberformat* pFormat = pFormatter->GetEntry(nKey);
2055 if ( pFormat && pFormat->IsStandard() )
2056 {
2057 // The standard format is all-latin if the decimal separator doesn't
2058 // have a different script type
2059
2060 String aDecSep;
2061 LanguageType nFormatLang = pFormat->GetLanguage();
2062 if ( nFormatLang == LANGUAGE_SYSTEM )
2063 aDecSep = ScGlobal::pLocaleData->getNumDecimalSep();
2064 else
2065 {
2066 LocaleDataWrapper aLocaleData( pDoc->GetServiceManager(),
2067 MsLangId::convertLanguageToLocale( nFormatLang ) );
2068 aDecSep = aLocaleData.getNumDecimalSep();
2069 }
2070
2071 sal_uInt8 nScript = pDoc->GetStringScriptType( aDecSep );
2072 if ( nScript == 0 || nScript == SCRIPTTYPE_LATIN )
2073 bLatinDefaultStyle = sal_True;
2074 }
2075 }
2076 }
2077 }
2078
SetChangeTrackingViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> & rChangeProps)2079 void ScXMLImport::SetChangeTrackingViewSettings(const com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>& rChangeProps)
2080 {
2081 if (pDoc)
2082 {
2083 sal_Int32 nCount(rChangeProps.getLength());
2084 if (nCount)
2085 {
2086 LockSolarMutex();
2087 sal_Int16 nTemp16(0);
2088 ScChangeViewSettings* pViewSettings(new ScChangeViewSettings());
2089 for (sal_Int32 i = 0; i < nCount; ++i)
2090 {
2091 rtl::OUString sName(rChangeProps[i].Name);
2092 if (sName.compareToAscii("ShowChanges") == 0)
2093 pViewSettings->SetShowChanges(::cppu::any2bool(rChangeProps[i].Value));
2094 else if (sName.compareToAscii("ShowAcceptedChanges") == 0)
2095 pViewSettings->SetShowAccepted(::cppu::any2bool(rChangeProps[i].Value));
2096 else if (sName.compareToAscii("ShowRejectedChanges") == 0)
2097 pViewSettings->SetShowRejected(::cppu::any2bool(rChangeProps[i].Value));
2098 else if (sName.compareToAscii("ShowChangesByDatetime") == 0)
2099 pViewSettings->SetHasDate(::cppu::any2bool(rChangeProps[i].Value));
2100 else if (sName.compareToAscii("ShowChangesByDatetimeMode") == 0)
2101 {
2102 if (rChangeProps[i].Value >>= nTemp16)
2103 pViewSettings->SetTheDateMode(ScChgsDateMode(nTemp16));
2104 }
2105 else if (sName.compareToAscii("ShowChangesByDatetimeFirstDatetime") == 0)
2106 {
2107 util::DateTime aDateTime;
2108 if (rChangeProps[i].Value >>= aDateTime)
2109 {
2110 DateTime aCoreDateTime;
2111 ScXMLConverter::ConvertAPIToCoreDateTime(aDateTime, aCoreDateTime);
2112 pViewSettings->SetTheFirstDateTime(aCoreDateTime);
2113 }
2114 }
2115 else if (sName.compareToAscii("ShowChangesByDatetimeSecondDatetime") == 0)
2116 {
2117 util::DateTime aDateTime;
2118 if (rChangeProps[i].Value >>= aDateTime)
2119 {
2120 DateTime aCoreDateTime;
2121 ScXMLConverter::ConvertAPIToCoreDateTime(aDateTime, aCoreDateTime);
2122 pViewSettings->SetTheLastDateTime(aCoreDateTime);
2123 }
2124 }
2125 else if (sName.compareToAscii("ShowChangesByAuthor") == 0)
2126 pViewSettings->SetHasAuthor(::cppu::any2bool(rChangeProps[i].Value));
2127 else if (sName.compareToAscii("ShowChangesByAuthorName") == 0)
2128 {
2129 rtl::OUString sOUName;
2130 if (rChangeProps[i].Value >>= sOUName)
2131 {
2132 String sAuthorName(sOUName);
2133 pViewSettings->SetTheAuthorToShow(sAuthorName);
2134 }
2135 }
2136 else if (sName.compareToAscii("ShowChangesByComment") == 0)
2137 pViewSettings->SetHasComment(::cppu::any2bool(rChangeProps[i].Value));
2138 else if (sName.compareToAscii("ShowChangesByCommentText") == 0)
2139 {
2140 rtl::OUString sOUComment;
2141 if (rChangeProps[i].Value >>= sOUComment)
2142 {
2143 String sComment(sOUComment);
2144 pViewSettings->SetTheComment(sComment);
2145 }
2146 }
2147 else if (sName.compareToAscii("ShowChangesByRanges") == 0)
2148 pViewSettings->SetHasRange(::cppu::any2bool(rChangeProps[i].Value));
2149 else if (sName.compareToAscii("ShowChangesByRangesList") == 0)
2150 {
2151 rtl::OUString sRanges;
2152 if ((rChangeProps[i].Value >>= sRanges) && sRanges.getLength())
2153 {
2154 ScRangeList aRangeList;
2155 ScRangeStringConverter::GetRangeListFromString(
2156 aRangeList, sRanges, GetDocument(), FormulaGrammar::CONV_OOO);
2157 pViewSettings->SetTheRangeList(aRangeList);
2158 }
2159 }
2160 }
2161 pDoc->SetChangeViewSettings(*pViewSettings);
2162 UnlockSolarMutex();
2163 }
2164 }
2165 }
2166
SetViewSettings(const uno::Sequence<beans::PropertyValue> & aViewProps)2167 void ScXMLImport::SetViewSettings(const uno::Sequence<beans::PropertyValue>& aViewProps)
2168 {
2169 sal_Int32 nCount(aViewProps.getLength());
2170 sal_Int32 nHeight(0);
2171 sal_Int32 nLeft(0);
2172 sal_Int32 nTop(0);
2173 sal_Int32 nWidth(0);
2174 for (sal_Int32 i = 0; i < nCount; ++i)
2175 {
2176 rtl::OUString sName(aViewProps[i].Name);
2177 if (sName.compareToAscii("VisibleAreaHeight") == 0)
2178 aViewProps[i].Value >>= nHeight;
2179 else if (sName.compareToAscii("VisibleAreaLeft") == 0)
2180 aViewProps[i].Value >>= nLeft;
2181 else if (sName.compareToAscii("VisibleAreaTop") == 0)
2182 aViewProps[i].Value >>= nTop;
2183 else if (sName.compareToAscii("VisibleAreaWidth") == 0)
2184 aViewProps[i].Value >>= nWidth;
2185 else if (sName.compareToAscii("TrackedChangesViewSettings") == 0)
2186 {
2187 uno::Sequence<beans::PropertyValue> aChangeProps;
2188 if(aViewProps[i].Value >>= aChangeProps)
2189 SetChangeTrackingViewSettings(aChangeProps);
2190 }
2191 }
2192 if (nHeight && nWidth)
2193 {
2194 if (GetModel().is())
2195 {
2196 ScModelObj* pDocObj(ScModelObj::getImplementation( GetModel() ));
2197 if (pDocObj)
2198 {
2199 SfxObjectShell* pEmbeddedObj = pDocObj->GetEmbeddedObject();
2200 if (pEmbeddedObj)
2201 {
2202 Rectangle aRect;
2203 aRect.setX( nLeft );
2204 aRect.setY( nTop );
2205 aRect.setWidth( nWidth );
2206 aRect.setHeight( nHeight );
2207 pEmbeddedObj->SetVisArea(aRect);
2208 }
2209 }
2210 }
2211 }
2212 }
2213
SetConfigurationSettings(const uno::Sequence<beans::PropertyValue> & aConfigProps)2214 void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyValue>& aConfigProps)
2215 {
2216 if (GetModel().is())
2217 {
2218 uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
2219 if (xMultiServiceFactory.is())
2220 {
2221 sal_Int32 nCount(aConfigProps.getLength());
2222 rtl::OUString sCTName(RTL_CONSTASCII_USTRINGPARAM("TrackedChangesProtectionKey"));
2223 rtl::OUString sVBName(RTL_CONSTASCII_USTRINGPARAM("VBACompatibilityMode"));
2224 rtl::OUString sSCName(RTL_CONSTASCII_USTRINGPARAM("ScriptConfiguration"));
2225 for (sal_Int32 i = nCount - 1; i >= 0; --i)
2226 {
2227 if (aConfigProps[i].Name == sCTName)
2228 {
2229 rtl::OUString sKey;
2230 if (aConfigProps[i].Value >>= sKey)
2231 {
2232 uno::Sequence<sal_Int8> aPass;
2233 SvXMLUnitConverter::decodeBase64(aPass, sKey);
2234 if (aPass.getLength())
2235 {
2236 if (pDoc->GetChangeTrack())
2237 pDoc->GetChangeTrack()->SetProtection(aPass);
2238 else
2239 {
2240 ScStrCollection aUsers;
2241 ScChangeTrack* pTrack = new ScChangeTrack(pDoc, aUsers);
2242 pTrack->SetProtection(aPass);
2243 pDoc->SetChangeTrack(pTrack);
2244 }
2245 }
2246 }
2247 }
2248 // store the following items for later use (after document is loaded)
2249 else if ((aConfigProps[i].Name == sVBName) || (aConfigProps[i].Name == sSCName))
2250 {
2251 uno::Reference< beans::XPropertySet > xImportInfo = getImportInfo();
2252 if (xImportInfo.is())
2253 {
2254 uno::Reference< beans::XPropertySetInfo > xPropertySetInfo = xImportInfo->getPropertySetInfo();
2255 if (xPropertySetInfo.is() && xPropertySetInfo->hasPropertyByName(aConfigProps[i].Name))
2256 xImportInfo->setPropertyValue( aConfigProps[i].Name, aConfigProps[i].Value );
2257 }
2258 }
2259 }
2260 uno::Reference <uno::XInterface> xInterface = xMultiServiceFactory->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.SpreadsheetSettings")));
2261 uno::Reference <beans::XPropertySet> xProperties(xInterface, uno::UNO_QUERY);
2262 if (xProperties.is())
2263 SvXMLUnitConverter::convertPropertySet(xProperties, aConfigProps);
2264 }
2265 }
2266 }
2267
SetCurrencySymbol(const sal_Int32 nKey,const rtl::OUString & rCurrency)2268 sal_Int32 ScXMLImport::SetCurrencySymbol(const sal_Int32 nKey, const rtl::OUString& rCurrency)
2269 {
2270 uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
2271 if (xNumberFormatsSupplier.is())
2272 {
2273 uno::Reference <util::XNumberFormats> xLocalNumberFormats(xNumberFormatsSupplier->getNumberFormats());
2274 if (xLocalNumberFormats.is())
2275 {
2276 rtl::OUString sFormatString;
2277 try
2278 {
2279 uno::Reference <beans::XPropertySet> xProperties(xLocalNumberFormats->getByKey(nKey));
2280 if (xProperties.is())
2281 {
2282 lang::Locale aLocale;
2283 if (GetDocument() && (xProperties->getPropertyValue(sLocale) >>= aLocale))
2284 {
2285 LockSolarMutex();
2286 LocaleDataWrapper aLocaleData( GetDocument()->GetServiceManager(), aLocale );
2287 rtl::OUStringBuffer aBuffer(15);
2288 aBuffer.appendAscii("#");
2289 aBuffer.append( aLocaleData.getNumThousandSep() );
2290 aBuffer.appendAscii("##0");
2291 aBuffer.append( aLocaleData.getNumDecimalSep() );
2292 aBuffer.appendAscii("00 [$");
2293 aBuffer.append(rCurrency);
2294 aBuffer.appendAscii("]");
2295 UnlockSolarMutex();
2296 sFormatString = aBuffer.makeStringAndClear();
2297 sal_Int32 nNewKey = xLocalNumberFormats->queryKey(sFormatString, aLocale, sal_True);
2298 if (nNewKey == -1)
2299 nNewKey = xLocalNumberFormats->addNew(sFormatString, aLocale);
2300 return nNewKey;
2301 }
2302 }
2303 }
2304 catch ( util::MalformedNumberFormatException& rException )
2305 {
2306 rtl::OUString sErrorMessage(RTL_CONSTASCII_USTRINGPARAM("Fehler im Formatstring "));
2307 sErrorMessage += sFormatString;
2308 sErrorMessage += rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" an Position "));
2309 sErrorMessage += rtl::OUString::valueOf(rException.CheckPos);
2310 uno::Sequence<rtl::OUString> aSeq(1);
2311 aSeq[0] = sErrorMessage;
2312 uno::Reference<xml::sax::XLocator> xLocator;
2313 SetError(XMLERROR_API | XMLERROR_FLAG_ERROR, aSeq, rException.Message, xLocator);
2314 }
2315 }
2316 }
2317 return nKey;
2318 }
2319
IsCurrencySymbol(const sal_Int32 nNumberFormat,const rtl::OUString & sCurrentCurrency,const rtl::OUString & sBankSymbol)2320 sal_Bool ScXMLImport::IsCurrencySymbol(const sal_Int32 nNumberFormat, const rtl::OUString& sCurrentCurrency, const rtl::OUString& sBankSymbol)
2321 {
2322 uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
2323 if (xNumberFormatsSupplier.is())
2324 {
2325 uno::Reference <util::XNumberFormats> xLocalNumberFormats(xNumberFormatsSupplier->getNumberFormats());
2326 if (xLocalNumberFormats.is())
2327 {
2328 try
2329 {
2330 uno::Reference <beans::XPropertySet> xNumberPropertySet(xLocalNumberFormats->getByKey(nNumberFormat));
2331 if (xNumberPropertySet.is())
2332 {
2333 rtl::OUString sTemp;
2334 if ( xNumberPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_CURRENCYSYMBOL))) >>= sTemp)
2335 {
2336 if (sCurrentCurrency.equals(sTemp))
2337 return sal_True;
2338 // #i61657# This may be a legacy currency symbol that changed in the meantime.
2339 if (SvNumberFormatter::GetLegacyOnlyCurrencyEntry( sCurrentCurrency, sBankSymbol) != NULL)
2340 return true;
2341 // In the rare case that sCurrentCurrency is not the
2342 // currency symbol, but a matching ISO code
2343 // abbreviation instead that was obtained through
2344 // XMLNumberFormatAttributesExportHelper::GetCellType(),
2345 // check with the number format's symbol. This happens,
2346 // for example, in the es_BO locale, where a legacy
2347 // B$,BOB matched B$->BOP, which leads to
2348 // sCurrentCurrency being BOP, and the previous call
2349 // with BOP,BOB didn't find an entry, but B$,BOB will.
2350 return SvNumberFormatter::GetLegacyOnlyCurrencyEntry( sTemp, sBankSymbol) != NULL;
2351 }
2352 }
2353 }
2354 catch ( uno::Exception& )
2355 {
2356 DBG_ERROR("Numberformat not found");
2357 }
2358 }
2359 }
2360 return sal_False;
2361 }
2362
SetType(uno::Reference<beans::XPropertySet> & rProperties,sal_Int32 & rNumberFormat,const sal_Int16 nCellType,const rtl::OUString & rCurrency)2363 void ScXMLImport::SetType(uno::Reference <beans::XPropertySet>& rProperties,
2364 sal_Int32& rNumberFormat,
2365 const sal_Int16 nCellType,
2366 const rtl::OUString& rCurrency)
2367 {
2368 if ((nCellType != util::NumberFormat::TEXT) && (nCellType != util::NumberFormat::UNDEFINED))
2369 {
2370 if (rNumberFormat == -1)
2371 rProperties->getPropertyValue( sNumberFormat ) >>= rNumberFormat;
2372 DBG_ASSERT(rNumberFormat != -1, "no NumberFormat");
2373 sal_Bool bIsStandard;
2374 // sCurrentCurrency may be the ISO code abbreviation if the currency
2375 // symbol matches such, or if no match found the symbol itself!
2376 rtl::OUString sCurrentCurrency;
2377 sal_Int32 nCurrentCellType(
2378 GetNumberFormatAttributesExportHelper()->GetCellType(
2379 rNumberFormat, sCurrentCurrency, bIsStandard) & ~util::NumberFormat::DEFINED);
2380 if ((nCellType != nCurrentCellType) && !((nCellType == util::NumberFormat::NUMBER &&
2381 ((nCurrentCellType == util::NumberFormat::SCIENTIFIC) ||
2382 (nCurrentCellType == util::NumberFormat::FRACTION) ||
2383 (nCurrentCellType == util::NumberFormat::LOGICAL) ||
2384 (nCurrentCellType == 0))) || (nCurrentCellType == util::NumberFormat::TEXT)) && !((nCellType == util::NumberFormat::DATETIME) &&
2385 (nCurrentCellType == util::NumberFormat::DATE)))
2386 {
2387 if (!xNumberFormats.is())
2388 {
2389 uno::Reference <util::XNumberFormatsSupplier> xNumberFormatsSupplier(GetNumberFormatsSupplier());
2390 if (xNumberFormatsSupplier.is())
2391 xNumberFormats.set(xNumberFormatsSupplier->getNumberFormats());
2392 }
2393 if (xNumberFormats.is())
2394 {
2395 try
2396 {
2397 uno::Reference < beans::XPropertySet> xNumberFormatProperties(xNumberFormats->getByKey(rNumberFormat));
2398 if (xNumberFormatProperties.is())
2399 {
2400 if (nCellType != util::NumberFormat::CURRENCY)
2401 {
2402 lang::Locale aLocale;
2403 if ( xNumberFormatProperties->getPropertyValue(sLocale) >>= aLocale )
2404 {
2405 if (!xNumberFormatTypes.is())
2406 xNumberFormatTypes.set(uno::Reference <util::XNumberFormatTypes>(xNumberFormats, uno::UNO_QUERY));
2407 rProperties->setPropertyValue( sNumberFormat, uno::makeAny(xNumberFormatTypes->getStandardFormat(nCellType, aLocale)) );
2408 }
2409 }
2410 else if (rCurrency.getLength() && sCurrentCurrency.getLength())
2411 {
2412 if (!sCurrentCurrency.equals(rCurrency))
2413 if (!IsCurrencySymbol(rNumberFormat, sCurrentCurrency, rCurrency))
2414 rProperties->setPropertyValue( sNumberFormat, uno::makeAny(SetCurrencySymbol(rNumberFormat, rCurrency)));
2415 }
2416 }
2417 }
2418 catch ( uno::Exception& )
2419 {
2420 DBG_ERROR("Numberformat not found");
2421 }
2422 }
2423 }
2424 else
2425 {
2426 if ((nCellType == util::NumberFormat::CURRENCY) && rCurrency.getLength() && sCurrentCurrency.getLength() &&
2427 !sCurrentCurrency.equals(rCurrency) && !IsCurrencySymbol(rNumberFormat, sCurrentCurrency, rCurrency))
2428 rProperties->setPropertyValue( sNumberFormat, uno::makeAny(SetCurrencySymbol(rNumberFormat, rCurrency)));
2429 }
2430 }
2431 }
2432
AddStyleRange(const table::CellRangeAddress & rCellRange)2433 void ScXMLImport::AddStyleRange(const table::CellRangeAddress& rCellRange)
2434 {
2435 if (!xSheetCellRanges.is() && GetModel().is())
2436 {
2437 uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
2438 if (xMultiServiceFactory.is())
2439 xSheetCellRanges.set(uno::Reference <sheet::XSheetCellRangeContainer>(xMultiServiceFactory->createInstance(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SheetCellRanges"))), uno::UNO_QUERY));
2440 DBG_ASSERT(xSheetCellRanges.is(), "didn't get SheetCellRanges");
2441
2442 }
2443 xSheetCellRanges->addRangeAddress(rCellRange, sal_False);
2444 }
2445
SetStyleToRanges()2446 void ScXMLImport::SetStyleToRanges()
2447 {
2448 if (sPrevStyleName.getLength())
2449 {
2450 uno::Reference <beans::XPropertySet> xProperties (xSheetCellRanges, uno::UNO_QUERY);
2451 if (xProperties.is())
2452 {
2453 XMLTableStylesContext *pStyles((XMLTableStylesContext *)GetAutoStyles());
2454 XMLTableStyleContext* pStyle( pStyles ? (XMLTableStyleContext *)pStyles->FindStyleChildContext(
2455 XML_STYLE_FAMILY_TABLE_CELL, sPrevStyleName, sal_True) : NULL );
2456 if (pStyle)
2457 {
2458 pStyle->FillPropertySet(xProperties);
2459 sal_Int32 nNumberFormat(pStyle->GetNumberFormat());
2460 SetType(xProperties, nNumberFormat, nPrevCellType, sPrevCurrency);
2461
2462 // store first cell of first range for each style, once per sheet
2463 uno::Sequence<table::CellRangeAddress> aAddresses(xSheetCellRanges->getRangeAddresses());
2464 if ( aAddresses.getLength() > 0 )
2465 {
2466 const table::CellRangeAddress& rRange = aAddresses[0];
2467 if ( rRange.Sheet != pStyle->GetLastSheet() )
2468 {
2469 ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
2470 pSheetData->AddCellStyle( sPrevStyleName,
2471 ScAddress( (SCCOL)rRange.StartColumn, (SCROW)rRange.StartRow, (SCTAB)rRange.Sheet ) );
2472 pStyle->SetLastSheet(rRange.Sheet);
2473 }
2474 }
2475 }
2476 else
2477 {
2478 xProperties->setPropertyValue(sCellStyle, uno::makeAny(GetStyleDisplayName( XML_STYLE_FAMILY_TABLE_CELL, sPrevStyleName )));
2479 sal_Int32 nNumberFormat(GetStyleNumberFormats()->GetStyleNumberFormat(sPrevStyleName));
2480 sal_Bool bInsert(nNumberFormat == -1);
2481 SetType(xProperties, nNumberFormat, nPrevCellType, sPrevCurrency);
2482 if (bInsert)
2483 GetStyleNumberFormats()->AddStyleNumberFormat(sPrevStyleName, nNumberFormat);
2484 }
2485 }
2486 }
2487 if (GetModel().is())
2488 {
2489 uno::Reference <lang::XMultiServiceFactory> xMultiServiceFactory(GetModel(), uno::UNO_QUERY);
2490 if (xMultiServiceFactory.is())
2491 xSheetCellRanges.set(uno::Reference <sheet::XSheetCellRangeContainer>(
2492 xMultiServiceFactory->createInstance(
2493 rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.sheet.SheetCellRanges"))),
2494 uno::UNO_QUERY));
2495 }
2496 DBG_ASSERT(xSheetCellRanges.is(), "didn't get SheetCellRanges");
2497 }
2498
SetStyleToRange(const ScRange & rRange,const rtl::OUString * pStyleName,const sal_Int16 nCellType,const rtl::OUString * pCurrency)2499 void ScXMLImport::SetStyleToRange(const ScRange& rRange, const rtl::OUString* pStyleName,
2500 const sal_Int16 nCellType, const rtl::OUString* pCurrency)
2501 {
2502 if (!sPrevStyleName.getLength())
2503 {
2504 nPrevCellType = nCellType;
2505 if (pStyleName)
2506 sPrevStyleName = *pStyleName;
2507 if (pCurrency)
2508 sPrevCurrency = *pCurrency;
2509 else if (sPrevCurrency.getLength())
2510 sPrevCurrency = sEmpty;
2511 }
2512 else if ((nCellType != nPrevCellType) ||
2513 ((pStyleName && !pStyleName->equals(sPrevStyleName)) ||
2514 (!pStyleName && sPrevStyleName.getLength())) ||
2515 ((pCurrency && !pCurrency->equals(sPrevCurrency)) ||
2516 (!pCurrency && sPrevCurrency.getLength())))
2517 {
2518 SetStyleToRanges();
2519 nPrevCellType = nCellType;
2520 if (pStyleName)
2521 sPrevStyleName = *pStyleName;
2522 else if(sPrevStyleName.getLength())
2523 sPrevStyleName = sEmpty;
2524 if (pCurrency)
2525 sPrevCurrency = *pCurrency;
2526 else if(sPrevCurrency.getLength())
2527 sPrevCurrency = sEmpty;
2528 }
2529 table::CellRangeAddress aCellRange;
2530 aCellRange.StartColumn = rRange.aStart.Col();
2531 aCellRange.StartRow = rRange.aStart.Row();
2532 aCellRange.Sheet = rRange.aStart.Tab();
2533 aCellRange.EndColumn = rRange.aEnd.Col();
2534 aCellRange.EndRow = rRange.aEnd.Row();
2535 AddStyleRange(aCellRange);
2536 }
2537
SetNullDateOnUnitConverter()2538 sal_Bool ScXMLImport::SetNullDateOnUnitConverter()
2539 {
2540 if (!bNullDateSetted)
2541 bNullDateSetted = GetMM100UnitConverter().setNullDate(GetModel());
2542 DBG_ASSERT(bNullDateSetted, "could not set the null date");
2543 return bNullDateSetted;
2544 }
2545
GetNumberFormatAttributesExportHelper()2546 XMLNumberFormatAttributesExportHelper* ScXMLImport::GetNumberFormatAttributesExportHelper()
2547 {
2548 if (!pNumberFormatAttributesExportHelper)
2549 pNumberFormatAttributesExportHelper = new XMLNumberFormatAttributesExportHelper(GetNumberFormatsSupplier());
2550 return pNumberFormatAttributesExportHelper;
2551 }
2552
GetStyleNumberFormats()2553 ScMyStyleNumberFormats* ScXMLImport::GetStyleNumberFormats()
2554 {
2555 if (!pStyleNumberFormats)
2556 pStyleNumberFormats = new ScMyStyleNumberFormats();
2557 return pStyleNumberFormats;
2558 }
2559
SetStylesToRangesFinished()2560 void ScXMLImport::SetStylesToRangesFinished()
2561 {
2562 SetStyleToRanges();
2563 sPrevStyleName = sEmpty;
2564 }
2565
2566 // XImporter
setTargetDocument(const::com::sun::star::uno::Reference<::com::sun::star::lang::XComponent> & xDoc)2567 void SAL_CALL ScXMLImport::setTargetDocument( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent >& xDoc )
2568 throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
2569 {
2570 LockSolarMutex();
2571 SvXMLImport::setTargetDocument( xDoc );
2572
2573 uno::Reference<frame::XModel> xModel(xDoc, uno::UNO_QUERY);
2574 pDoc = ScXMLConverter::GetScDocument( xModel );
2575 DBG_ASSERT( pDoc, "ScXMLImport::setTargetDocument - no ScDocument!" );
2576 if (!pDoc)
2577 throw lang::IllegalArgumentException();
2578
2579 bFromWrapper = pDoc->IsXMLFromWrapper(); // UnlockSolarMutex below still works normally
2580
2581 uno::Reference<document::XActionLockable> xActionLockable(xDoc, uno::UNO_QUERY);
2582 if (xActionLockable.is())
2583 xActionLockable->addActionLock();
2584 UnlockSolarMutex();
2585 }
2586
2587 // XServiceInfo
getImplementationName()2588 ::rtl::OUString SAL_CALL ScXMLImport::getImplementationName( )
2589 throw(::com::sun::star::uno::RuntimeException)
2590 {
2591 switch( getImportFlags() )
2592 {
2593 case IMPORT_ALL:
2594 return ScXMLImport_getImplementationName();
2595 case (IMPORT_STYLES|IMPORT_MASTERSTYLES|IMPORT_AUTOSTYLES|IMPORT_FONTDECLS):
2596 return ScXMLImport_Styles_getImplementationName();
2597 case (IMPORT_AUTOSTYLES|IMPORT_CONTENT|IMPORT_SCRIPTS|IMPORT_FONTDECLS):
2598 return ScXMLImport_Content_getImplementationName();
2599 case IMPORT_META:
2600 return ScXMLImport_Meta_getImplementationName();
2601 case IMPORT_SETTINGS:
2602 return ScXMLImport_Settings_getImplementationName();
2603 default:
2604 // generic name for 'unknown' cases
2605 return ScXMLImport_getImplementationName();
2606 }
2607 }
2608
2609 // ::com::sun::star::xml::sax::XDocumentHandler
startDocument(void)2610 void SAL_CALL ScXMLImport::startDocument(void)
2611 throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException )
2612 {
2613 LockSolarMutex();
2614 SvXMLImport::startDocument();
2615 if (pDoc && !pDoc->IsImportingXML())
2616 {
2617 ScModelObj::getImplementation(GetModel())->BeforeXMLLoading();
2618 bSelfImportingXMLSet = sal_True;
2619 }
2620
2621 // if content and styles are loaded with separate imports,
2622 // set bLatinDefaultStyle flag at the start of the content import
2623 sal_uInt16 nFlags = getImportFlags();
2624 if ( ( nFlags & IMPORT_CONTENT ) && !( nFlags & IMPORT_STYLES ) )
2625 ExamineDefaultStyle();
2626
2627 if (getImportFlags() & IMPORT_CONTENT)
2628 {
2629 if (GetModel().is())
2630 {
2631 // store initial namespaces, to find the ones that were added from the file later
2632 ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
2633 const SvXMLNamespaceMap& rNamespaces = GetNamespaceMap();
2634 pSheetData->StoreInitialNamespaces(rNamespaces);
2635 }
2636 }
2637
2638 uno::Reference< beans::XPropertySet > const xImportInfo( getImportInfo() );
2639 uno::Reference< beans::XPropertySetInfo > const xPropertySetInfo(
2640 xImportInfo.is() ? xImportInfo->getPropertySetInfo() : 0);
2641 if (xPropertySetInfo.is())
2642 {
2643 ::rtl::OUString const sOrganizerMode(
2644 RTL_CONSTASCII_USTRINGPARAM("OrganizerMode"));
2645 if (xPropertySetInfo->hasPropertyByName(sOrganizerMode))
2646 {
2647 sal_Bool bStyleOnly(sal_False);
2648 if (xImportInfo->getPropertyValue(sOrganizerMode) >>= bStyleOnly)
2649 {
2650 bLoadDoc = !bStyleOnly;
2651 }
2652 }
2653 }
2654
2655 UnlockSolarMutex();
2656 }
2657
GetRangeType(const rtl::OUString sRangeType) const2658 sal_Int32 ScXMLImport::GetRangeType(const rtl::OUString sRangeType) const
2659 {
2660 sal_Int32 nRangeType(0);
2661 rtl::OUStringBuffer sBuffer;
2662 sal_Int16 i = 0;
2663 while (i <= sRangeType.getLength())
2664 {
2665 if ((sRangeType[i] == ' ') || (i == sRangeType.getLength()))
2666 {
2667 rtl::OUString sTemp = sBuffer.makeStringAndClear();
2668 if (sTemp.compareToAscii(SC_REPEAT_COLUMN) == 0)
2669 nRangeType |= sheet::NamedRangeFlag::COLUMN_HEADER;
2670 else if (sTemp.compareToAscii(SC_REPEAT_ROW) == 0)
2671 nRangeType |= sheet::NamedRangeFlag::ROW_HEADER;
2672 else if (sTemp.compareToAscii(SC_FILTER) == 0)
2673 nRangeType |= sheet::NamedRangeFlag::FILTER_CRITERIA;
2674 else if (sTemp.compareToAscii(SC_PRINT_RANGE) == 0)
2675 nRangeType |= sheet::NamedRangeFlag::PRINT_AREA;
2676 }
2677 else if (i < sRangeType.getLength())
2678 sBuffer.append(sRangeType[i]);
2679 ++i;
2680 }
2681 return nRangeType;
2682 }
2683
SetLabelRanges()2684 void ScXMLImport::SetLabelRanges()
2685 {
2686 ScMyLabelRanges* pLabelRanges = GetLabelRanges();
2687 if (pLabelRanges)
2688 {
2689 uno::Reference <beans::XPropertySet> xPropertySet (GetModel(), uno::UNO_QUERY);
2690 if (xPropertySet.is())
2691 {
2692 uno::Any aColAny = xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_COLLABELRNG)));
2693 uno::Any aRowAny = xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNO_ROWLABELRNG)));
2694
2695 uno::Reference< sheet::XLabelRanges > xColRanges;
2696 uno::Reference< sheet::XLabelRanges > xRowRanges;
2697
2698 if ( ( aColAny >>= xColRanges ) && ( aRowAny >>= xRowRanges ) )
2699 {
2700 table::CellRangeAddress aLabelRange;
2701 table::CellRangeAddress aDataRange;
2702
2703 ScMyLabelRanges::iterator aItr = pLabelRanges->begin();
2704 while (aItr != pLabelRanges->end())
2705 {
2706 sal_Int32 nOffset1(0);
2707 sal_Int32 nOffset2(0);
2708 FormulaGrammar::AddressConvention eConv = FormulaGrammar::CONV_OOO;
2709
2710 if (ScRangeStringConverter::GetRangeFromString( aLabelRange, (*aItr)->sLabelRangeStr, GetDocument(), eConv, nOffset1 ) &&
2711 ScRangeStringConverter::GetRangeFromString( aDataRange, (*aItr)->sDataRangeStr, GetDocument(), eConv, nOffset2 ))
2712 {
2713 if ( (*aItr)->bColumnOrientation )
2714 xColRanges->addNew( aLabelRange, aDataRange );
2715 else
2716 xRowRanges->addNew( aLabelRange, aDataRange );
2717 }
2718
2719 delete *aItr;
2720 aItr = pLabelRanges->erase(aItr);
2721 }
2722 }
2723 }
2724 }
2725 }
2726
SetNamedRanges()2727 void ScXMLImport::SetNamedRanges()
2728 {
2729 ScMyNamedExpressions* pNamedExpressions(GetNamedExpressions());
2730 if (pNamedExpressions)
2731 {
2732 uno::Reference <beans::XPropertySet> xPropertySet (GetModel(), uno::UNO_QUERY);
2733 if (xPropertySet.is())
2734 {
2735 uno::Reference <sheet::XNamedRanges2> xNamedRanges(xPropertySet->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_NAMEDRANGES))), uno::UNO_QUERY);
2736 if (xNamedRanges.is())
2737 {
2738 ScMyNamedExpressions::iterator aItr(pNamedExpressions->begin());
2739 ScMyNamedExpressions::const_iterator aEndItr(pNamedExpressions->end());
2740 table::CellAddress aCellAddress;
2741 rtl::OUString sTempContent(RTL_CONSTASCII_USTRINGPARAM("0"));
2742 while (aItr != aEndItr)
2743 {
2744 sal_Int32 nOffset(0);
2745 if (ScRangeStringConverter::GetAddressFromString(
2746 aCellAddress, (*aItr)->sBaseCellAddress, GetDocument(), FormulaGrammar::CONV_OOO, nOffset ))
2747 {
2748 try
2749 {
2750 //xNamedRanges->addNewByName((*aItr)->sName, sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType));//String::CreateFromInt32( (*aItr)->nNameScope)
2751 String sTabName;
2752 GetDocument()->GetName( (*aItr)->nNameScope, sTabName);
2753 xNamedRanges->addNewByScopeName( sTabName, (*aItr)->sName, sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType) );
2754 }
2755 catch( uno::RuntimeException& )
2756 {
2757 DBG_ERROR("here are some Named Ranges with the same name");
2758 uno::Reference < container::XIndexAccess > xIndex(xNamedRanges, uno::UNO_QUERY);
2759 if (xIndex.is())
2760 {
2761 sal_Int32 nMax(xIndex->getCount());
2762 sal_Bool bInserted(sal_False);
2763 sal_Int32 nCount(1);
2764 rtl::OUStringBuffer sName((*aItr)->sName);
2765 sName.append(sal_Unicode('_'));
2766 while (!bInserted && nCount <= nMax)
2767 {
2768 rtl::OUStringBuffer sTemp(sName);
2769 sTemp.append(rtl::OUString::valueOf(nCount));
2770 try
2771 {
2772 xNamedRanges->addNewByName(sTemp.makeStringAndClear(), sTempContent, aCellAddress, GetRangeType((*aItr)->sRangeType));
2773 bInserted = sal_True;
2774 }
2775 catch( uno::RuntimeException& )
2776 {
2777 ++nCount;
2778 }
2779 }
2780 }
2781 }
2782 }
2783 ++aItr;
2784 }
2785 aItr = pNamedExpressions->begin();
2786 while (aItr != aEndItr)
2787 {
2788 sal_Int32 nOffset(0);
2789 if (ScRangeStringConverter::GetAddressFromString(
2790 aCellAddress, (*aItr)->sBaseCellAddress, GetDocument(), FormulaGrammar::CONV_OOO, nOffset ))
2791 {
2792 //uno::Reference <sheet::XNamedRange> xNamedRange(xNamedRanges->getByName((*aItr)->sName), uno::UNO_QUERY);
2793 String sTableName;
2794 GetDocument()->GetName( (*aItr)->nNameScope, sTableName );
2795 rtl::OUString sRangeScope( sTableName);
2796 uno::Reference <sheet::XNamedRange2> xNamedRange(xNamedRanges->getByScopeName( sRangeScope,(*aItr)->sName), uno::UNO_QUERY);
2797 if (xNamedRange.is())
2798 {
2799 LockSolarMutex();
2800 ScNamedRangeObj* pNamedRangeObj = ScNamedRangeObj::getImplementation( xNamedRange);
2801 if (pNamedRangeObj)
2802 {
2803 sTempContent = (*aItr)->sContent;
2804 // Get rid of leading sheet dots in simple ranges.
2805 if (!(*aItr)->bIsExpression)
2806 ScXMLConverter::ParseFormula( sTempContent, false);
2807 pNamedRangeObj->SetContentWithGrammar( sTempContent, (*aItr)->eGrammar);
2808 }
2809 UnlockSolarMutex();
2810 }
2811 }
2812 delete *aItr;
2813 aItr = pNamedExpressions->erase(aItr);
2814 }
2815 }
2816 }
2817 }
2818 }
2819
endDocument(void)2820 void SAL_CALL ScXMLImport::endDocument(void)
2821 throw( ::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException )
2822 {
2823 LockSolarMutex();
2824 if (getImportFlags() & IMPORT_CONTENT)
2825 {
2826 if (GetModel().is())
2827 {
2828 uno::Reference<document::XViewDataSupplier> xViewDataSupplier(GetModel(), uno::UNO_QUERY);
2829 if (xViewDataSupplier.is())
2830 {
2831 uno::Reference<container::XIndexAccess> xIndexAccess(xViewDataSupplier->getViewData());
2832 if (xIndexAccess.is() && xIndexAccess->getCount() > 0)
2833 {
2834 uno::Sequence< beans::PropertyValue > aSeq;
2835 if (xIndexAccess->getByIndex(0) >>= aSeq)
2836 {
2837 sal_Int32 nCount (aSeq.getLength());
2838 for (sal_Int32 i = 0; i < nCount; ++i)
2839 {
2840 rtl::OUString sName(aSeq[i].Name);
2841 if (sName.compareToAscii(SC_ACTIVETABLE) == 0)
2842 {
2843 rtl::OUString sValue;
2844 if(aSeq[i].Value >>= sValue)
2845 {
2846 String sTabName(sValue);
2847 SCTAB nTab(0);
2848 if (pDoc->GetTable(sTabName, nTab))
2849 {
2850 pDoc->SetVisibleTab(nTab);
2851 i = nCount;
2852 }
2853 }
2854 }
2855 }
2856 }
2857 }
2858 }
2859 SetLabelRanges();
2860 SetNamedRanges();
2861 }
2862 GetProgressBarHelper()->End(); // make room for subsequent SfxProgressBars
2863 if (pDoc)
2864 {
2865 pDoc->CompileXML();
2866
2867 // After CompileXML, links must be completely changed to the new URLs.
2868 // Otherwise, hasExternalFile for API wouldn't work (#i116940#),
2869 // and typing a new formula would create a second link with the same "real" file name.
2870 if (pDoc->HasExternalRefManager())
2871 pDoc->GetExternalRefManager()->updateAbsAfterLoad();
2872 }
2873
2874 // If the stream contains cells outside of the current limits, the styles can't be re-created,
2875 // so stream copying is disabled then.
2876 if (pDoc && GetModel().is() && !pDoc->HasRangeOverflow())
2877 {
2878 // set "valid stream" flags after loading (before UpdateRowHeights, so changed formula results
2879 // in UpdateRowHeights can already clear the flags again)
2880 ScSheetSaveData* pSheetData = ScModelObj::getImplementation(GetModel())->GetSheetSaveData();
2881
2882 SCTAB nTabCount = pDoc->GetTableCount();
2883 for (SCTAB nTab=0; nTab<nTabCount; ++nTab)
2884 if (!pSheetData->IsSheetBlocked( nTab ))
2885 pDoc->SetStreamValid( nTab, sal_True );
2886 }
2887
2888 aTables.UpdateRowHeights();
2889 aTables.ResizeShapes();
2890 }
2891 if (GetModel().is())
2892 {
2893 uno::Reference<document::XActionLockable> xActionLockable(GetModel(), uno::UNO_QUERY);
2894 if (xActionLockable.is())
2895 xActionLockable->removeActionLock();
2896 }
2897 SvXMLImport::endDocument();
2898
2899 if (pDoc && bSelfImportingXMLSet)
2900 {
2901 ScModelObj::getImplementation(GetModel())->AfterXMLLoading(sal_True);
2902 }
2903
2904 UnlockSolarMutex();
2905 }
2906
2907 // XEventListener
DisposingModel()2908 void ScXMLImport::DisposingModel()
2909 {
2910 SvXMLImport::DisposingModel();
2911 pDoc = NULL;
2912 }
2913
LockSolarMutex()2914 void ScXMLImport::LockSolarMutex()
2915 {
2916 // #i62677# When called from DocShell/Wrapper, the SolarMutex is already locked,
2917 // so there's no need to allocate (and later delete) the ScUnoGuard.
2918 if (bFromWrapper)
2919 {
2920 DBG_TESTSOLARMUTEX();
2921 return;
2922 }
2923
2924 if (nSolarMutexLocked == 0)
2925 {
2926 DBG_ASSERT(!pScUnoGuard, "Solar Mutex is locked");
2927 pScUnoGuard = new ScUnoGuard();
2928 }
2929 ++nSolarMutexLocked;
2930 }
2931
2932
UnlockSolarMutex()2933 void ScXMLImport::UnlockSolarMutex()
2934 {
2935 if (nSolarMutexLocked > 0)
2936 {
2937 nSolarMutexLocked--;
2938 if (nSolarMutexLocked == 0)
2939 {
2940 DBG_ASSERT(pScUnoGuard, "Solar Mutex is always unlocked");
2941 delete pScUnoGuard;
2942 pScUnoGuard = NULL;
2943 }
2944 }
2945 }
2946
GetByteOffset()2947 sal_Int32 ScXMLImport::GetByteOffset()
2948 {
2949 sal_Int32 nOffset = -1;
2950 uno::Reference<xml::sax::XLocator> xLocator = GetLocator();
2951 uno::Reference<io::XSeekable> xSeek( xLocator, uno::UNO_QUERY ); //! should use different interface
2952 if ( xSeek.is() )
2953 nOffset = (sal_Int32)xSeek->getPosition();
2954 return nOffset;
2955 }
2956
SetRangeOverflowType(sal_uInt32 nType)2957 void ScXMLImport::SetRangeOverflowType(sal_uInt32 nType)
2958 {
2959 // #i31130# Overflow is stored in the document, because the ScXMLImport object
2960 // isn't available in ScXMLImportWrapper::ImportFromComponent when using the
2961 // OOo->Oasis transformation.
2962
2963 if ( pDoc )
2964 pDoc->SetRangeOverflowType( nType );
2965 }
2966
ProgressBarIncrement(sal_Bool bEditCell,sal_Int32 nInc)2967 void ScXMLImport::ProgressBarIncrement(sal_Bool bEditCell, sal_Int32 nInc)
2968 {
2969 nProgressCount += nInc;
2970 if (bEditCell || nProgressCount > 100)
2971 {
2972 GetProgressBarHelper()->Increment(nProgressCount);
2973 nProgressCount = 0;
2974 }
2975 }
2976
GetVisibleSheet()2977 sal_Int32 ScXMLImport::GetVisibleSheet()
2978 {
2979 // Get the visible sheet number from model's view data (after settings were loaded),
2980 // or 0 (default: first sheet) if no settings available.
2981
2982 uno::Reference<document::XViewDataSupplier> xSupp(GetModel(), uno::UNO_QUERY);
2983 if (xSupp.is())
2984 {
2985 uno::Reference<container::XIndexAccess> xIndex = xSupp->getViewData();
2986 if ( xIndex.is() && xIndex->getCount() > 0 )
2987 {
2988 uno::Any aAny( xIndex->getByIndex(0) );
2989 uno::Sequence<beans::PropertyValue> aViewSettings; // settings for (first) view
2990 if ( aAny >>= aViewSettings )
2991 {
2992 sal_Int32 nCount = aViewSettings.getLength();
2993 for (sal_Int32 i = 0; i < nCount; ++i)
2994 {
2995 if ( aViewSettings[i].Name.compareToAscii(SC_ACTIVETABLE) == 0 )
2996 {
2997 rtl::OUString sValue;
2998 if(aViewSettings[i].Value >>= sValue)
2999 {
3000 String sTabName(sValue);
3001 SCTAB nTab = 0;
3002 if (pDoc->GetTable(sTabName, nTab))
3003 return nTab;
3004 }
3005 }
3006 }
3007 }
3008 }
3009 }
3010
3011 return 0;
3012 }
3013
ExtractFormulaNamespaceGrammar(OUString & rFormula,OUString & rFormulaNmsp,FormulaGrammar::Grammar & reGrammar,const OUString & rAttrValue,bool bRestrictToExternalNmsp) const3014 void ScXMLImport::ExtractFormulaNamespaceGrammar(
3015 OUString& rFormula, OUString& rFormulaNmsp, FormulaGrammar::Grammar& reGrammar,
3016 const OUString& rAttrValue, bool bRestrictToExternalNmsp ) const
3017 {
3018 // parse the attribute value, extract namespace ID, literal namespace, and formula string
3019 rFormulaNmsp = OUString();
3020 sal_uInt16 nNsId = GetNamespaceMap()._GetKeyByAttrName( rAttrValue, 0, &rFormula, &rFormulaNmsp, sal_False );
3021
3022 // check if we have an ODF formula namespace
3023 if( !bRestrictToExternalNmsp ) switch( nNsId )
3024 {
3025 case XML_NAMESPACE_OOOC:
3026 rFormulaNmsp = OUString(); // remove namespace string for built-in grammar
3027 reGrammar = FormulaGrammar::GRAM_PODF;
3028 return;
3029 case XML_NAMESPACE_OF:
3030 rFormulaNmsp = OUString(); // remove namespace string for built-in grammar
3031 reGrammar = FormulaGrammar::GRAM_ODFF;
3032 return;
3033 }
3034
3035 /* Find default grammar for formulas without namespace. There may be
3036 documents in the wild that stored no namespace in ODF 1.0/1.1. Use
3037 GRAM_PODF then (old style ODF 1.0/1.1 formulas). The default for ODF
3038 1.2 and later without namespace is GRAM_ODFF (OpenFormula). */
3039 FormulaGrammar::Grammar eDefaultGrammar =
3040 (GetDocument()->GetStorageGrammar() == FormulaGrammar::GRAM_PODF) ?
3041 FormulaGrammar::GRAM_PODF : FormulaGrammar::GRAM_ODFF;
3042
3043 /* Check if we have no namespace at all. The value XML_NAMESPACE_NONE
3044 indicates that there is no colon. If the first character of the
3045 attribute value is the equality sign, the value XML_NAMESPACE_UNKNOWN
3046 indicates that there is a colon somewhere in the formula string. */
3047 if( (nNsId == XML_NAMESPACE_NONE) || ((nNsId == XML_NAMESPACE_UNKNOWN) && (rAttrValue.toChar() == '=')) )
3048 {
3049 rFormula = rAttrValue; // return entire string as formula
3050 reGrammar = eDefaultGrammar;
3051 return;
3052 }
3053
3054 /* Check if a namespace URL could be resolved from the attribute value.
3055 Use that namespace only, if the Calc document knows an associated
3056 external formula parser. This prevents that the range operator in
3057 conjunction with defined names is confused as namespaces prefix, e.g.
3058 in the expression 'table:A1' where 'table' is a named reference. */
3059 if( ((nNsId & XML_NAMESPACE_UNKNOWN_FLAG) != 0) && (rFormulaNmsp.getLength() > 0) &&
3060 GetDocument()->GetFormulaParserPool().hasFormulaParser( rFormulaNmsp ) )
3061 {
3062 reGrammar = FormulaGrammar::GRAM_EXTERNAL;
3063 return;
3064 }
3065
3066 /* All attempts failed (e.g. no namespace and no leading equality sign, or
3067 an invalid namespace prefix), continue with the entire attribute value. */
3068 rFormula = rAttrValue;
3069 rFormulaNmsp = OUString(); // remove any namespace string
3070 reGrammar = eDefaultGrammar;
3071 }
3072
3073