LibreOffice Module sc (master)  1
xename.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <xename.hxx>
21 
22 #include <map>
23 
24 #include <document.hxx>
25 #include <rangenam.hxx>
26 #include <tokenarray.hxx>
27 #include <xehelper.hxx>
28 #include <xelink.hxx>
29 #include <excrecds.hxx>
30 #include <xlname.hxx>
31 #include <xeformula.hxx>
32 #include <xestring.hxx>
33 #include <xltools.hxx>
34 
35 #include <formula/grammar.hxx>
36 #include <oox/export/utils.hxx>
37 #include <oox/token/tokens.hxx>
38 
39 using namespace ::oox;
40 
41 // *** Helper classes ***
42 
43 namespace {
44 
46 class XclExpName : public XclExpRecord, protected XclExpRoot
47 {
48 public:
50  explicit XclExpName( const XclExpRoot& rRoot, const OUString& rName );
52  explicit XclExpName( const XclExpRoot& rRoot, sal_Unicode cBuiltIn );
53 
55  void SetTokenArray( const XclTokenArrayRef& xTokArr );
57  void SetLocalTab( SCTAB nScTab );
59  void SetHidden( bool bHidden = true );
63  void SetMacroCall( bool bVBasic, bool bFunc );
64 
67  void SetSymbol( const OUString& rValue );
68 
70  const OUString& GetOrigName() const { return maOrigName; }
73  sal_Unicode GetBuiltInName() const { return mcBuiltIn; }
74 
76  const OUString& GetSymbol() const { return msSymbol; }
77 
79  bool IsGlobal() const { return mnXclTab == EXC_NAME_GLOBAL; }
81  SCTAB GetScTab() const { return mnScTab; }
82 
84  bool IsVolatile() const;
87  bool IsMacroCall( bool bVBasic, bool bFunc ) const;
88 
90  virtual void Save( XclExpStream& rStrm ) override;
91 
92  virtual void SaveXml( XclExpXmlStream& rStrm ) override;
93 
94 private:
96  virtual void WriteBody( XclExpStream& rStrm ) override;
98  OUString GetWithDefaultRangeSeparator( const OUString& rSymbol ) const;
99 
100 private:
101  OUString maOrigName;
102  OUString msSymbol;
103  XclExpStringRef mxName;
104  XclTokenArrayRef mxTokArr;
105  sal_Unicode mcBuiltIn;
106  SCTAB mnScTab;
107  sal_uInt16 mnFlags;
108  sal_uInt16 mnExtSheet;
109  sal_uInt16 mnXclTab;
110 };
111 
112 }
113 
116 {
117 public:
118  explicit XclExpNameManagerImpl( const XclExpRoot& rRoot );
119 
121  void Initialize();
122 
124  sal_uInt16 InsertName( SCTAB nTab, sal_uInt16 nScNameIdx, SCTAB nCurrTab );
125 
127  sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, const XclTokenArrayRef& xTokArr, SCTAB nScTab, const ScRangeList& aRangeList );
128  sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, const XclTokenArrayRef& xTokArr, const ScRange& aRange );
130  sal_uInt16 InsertUniqueName( const OUString& rName, const XclTokenArrayRef& xTokArr, SCTAB nScTab );
132  sal_uInt16 InsertRawName( const OUString& rName );
136  sal_uInt16 InsertMacroCall( const OUString& rMacroName, bool bVBasic, bool bFunc, bool bHidden );
137 
139  const XclExpName* GetName( sal_uInt16 nNameIdx ) const;
140 
145  void Save( XclExpStream& rStrm );
146 
147  void SaveXml( XclExpXmlStream& rStrm );
148 
149 private:
152 
153  typedef ::std::map< ::std::pair<SCTAB, OUString>, sal_uInt16> NamedExpMap;
154 
155 private:
162  sal_uInt16 FindNamedExp( SCTAB nTab, OUString sName );
163 
165  sal_uInt16 FindBuiltInNameIdx( const OUString& rName,
166  const OUString& sSymbol ) const;
168  OUString GetUnusedName( const OUString& rName ) const;
169 
172  sal_uInt16 Append( XclExpName* pName );
173  sal_uInt16 Append( XclExpNameRef const & rxName ) { return Append(rxName.get()); }
176  sal_uInt16 CreateName( SCTAB nTab, const ScRangeData& rRangeData );
177 
179  void CreateBuiltInNames();
181  void CreateUserNames();
182 
183 private:
189  NamedExpMap maNamedExpMap;
190  XclExpNameList maNameList;
191  size_t mnFirstUserIdx;
192 };
193 
194 // *** Implementation ***
195 
196 XclExpName::XclExpName( const XclExpRoot& rRoot, const OUString& rName ) :
198  XclExpRoot( rRoot ),
199  maOrigName( rName ),
200  mxName( XclExpStringHelper::CreateString( rRoot, rName, XclStrFlags::EightBitLength ) ),
201  mcBuiltIn( EXC_BUILTIN_UNKNOWN ),
202  mnScTab( SCTAB_GLOBAL ),
204  mnExtSheet( EXC_NAME_GLOBAL ),
205  mnXclTab( EXC_NAME_GLOBAL )
206 {
207 }
208 
209 XclExpName::XclExpName( const XclExpRoot& rRoot, sal_Unicode cBuiltIn ) :
211  XclExpRoot( rRoot ),
212  mcBuiltIn( cBuiltIn ),
213  mnScTab( SCTAB_GLOBAL ),
215  mnExtSheet( EXC_NAME_GLOBAL ),
216  mnXclTab( EXC_NAME_GLOBAL )
217 {
218  // filter source range is hidden in Excel
219  if( cBuiltIn == EXC_BUILTIN_FILTERDATABASE )
220  SetHidden();
221 
222  // special case for BIFF5/7 filter source range - name appears as plain text without built-in flag
223  if( (GetBiff() <= EXC_BIFF5) && (cBuiltIn == EXC_BUILTIN_FILTERDATABASE) )
224  {
227  maOrigName = XclTools::GetXclBuiltInDefName( cBuiltIn );
228  }
229  else
230  {
231  maOrigName = XclTools::GetBuiltInDefNameXml( cBuiltIn ) ;
234  }
235 }
236 
237 void XclExpName::SetTokenArray( const XclTokenArrayRef& xTokArr )
238 {
239  mxTokArr = xTokArr;
240 }
241 
242 void XclExpName::SetLocalTab( SCTAB nScTab )
243 {
244  OSL_ENSURE( GetTabInfo().IsExportTab( nScTab ), "XclExpName::SetLocalTab - invalid sheet index" );
245  if( !GetTabInfo().IsExportTab( nScTab ) )
246  return;
247 
248  mnScTab = nScTab;
249  GetGlobalLinkManager().FindExtSheet( mnExtSheet, mnXclTab, nScTab );
250 
251  // special handling for NAME record
252  switch( GetBiff() )
253  {
254  case EXC_BIFF5: // EXTERNSHEET index is positive in NAME record
255  mnExtSheet = ~mnExtSheet + 1;
256  break;
257  case EXC_BIFF8: // EXTERNSHEET index not used, but must be created in link table
258  mnExtSheet = 0;
259  break;
260  default: DBG_ERROR_BIFF();
261  }
262 
263  // Excel sheet index is 1-based
264  ++mnXclTab;
265 }
266 
267 void XclExpName::SetHidden( bool bHidden )
268 {
269  ::set_flag( mnFlags, EXC_NAME_HIDDEN, bHidden );
270 }
271 
272 void XclExpName::SetMacroCall( bool bVBasic, bool bFunc )
273 {
275  ::set_flag( mnFlags, EXC_NAME_VB, bVBasic );
276  ::set_flag( mnFlags, EXC_NAME_FUNC, bFunc );
277 }
278 
279 void XclExpName::SetSymbol( const OUString& rSymbol )
280 {
281  msSymbol = rSymbol;
282 }
283 
284 bool XclExpName::IsVolatile() const
285 {
286  return mxTokArr && mxTokArr->IsVolatile();
287 }
288 
289 bool XclExpName::IsMacroCall( bool bVBasic, bool bFunc ) const
290 {
291  return
292  (::get_flag( mnFlags, EXC_NAME_VB ) == bVBasic) &&
293  (::get_flag( mnFlags, EXC_NAME_FUNC ) == bFunc);
294 }
295 
296 void XclExpName::Save( XclExpStream& rStrm )
297 {
298  OSL_ENSURE( mxName && (mxName->Len() > 0), "XclExpName::Save - missing name" );
299  OSL_ENSURE( !(IsGlobal() && ::get_flag( mnFlags, EXC_NAME_BUILTIN )), "XclExpName::Save - global built-in name" );
300  SetRecSize( 11 + mxName->GetSize() + (mxTokArr ? mxTokArr->GetSize() : 2) );
301  XclExpRecord::Save( rStrm );
302 }
303 
304 OUString XclExpName::GetWithDefaultRangeSeparator( const OUString& rSymbol ) const
305 {
306  sal_Int32 nPos = rSymbol.indexOf(';');
307  if ( nPos > -1 )
308  {
309  // convert with validation
310  ScRange aRange;
312  ScRefFlags nRes = aRange.Parse( rSymbol.copy(0, nPos), GetDoc(), detailsXL );
313  if ( nRes & ScRefFlags::VALID )
314  {
315  nRes = aRange.Parse( rSymbol.copy(nPos+1), GetDoc(), detailsXL );
316  if ( nRes & ScRefFlags::VALID )
317  {
318  return rSymbol.replaceFirst(";", ",");
319  }
320  }
321  }
322  return rSymbol;
323 }
324 
325 void XclExpName::SaveXml( XclExpXmlStream& rStrm )
326 {
327  sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
328  rWorkbook->startElement( XML_definedName,
329  // OOXTODO: XML_comment, "",
330  // OOXTODO: XML_customMenu, "",
331  // OOXTODO: XML_description, "",
332  XML_function, ToPsz( ::get_flag( mnFlags, EXC_NAME_VB ) ),
333  // OOXTODO: XML_functionGroupId, "",
334  // OOXTODO: XML_help, "",
335  XML_hidden, ToPsz( ::get_flag( mnFlags, EXC_NAME_HIDDEN ) ),
336  XML_localSheetId, mnScTab == SCTAB_GLOBAL ? nullptr : OString::number( mnScTab ).getStr(),
337  XML_name, maOrigName.toUtf8(),
338  // OOXTODO: XML_publishToServer, "",
339  // OOXTODO: XML_shortcutKey, "",
340  // OOXTODO: XML_statusBar, "",
341  XML_vbProcedure, ToPsz( ::get_flag( mnFlags, EXC_NAME_VB ) )
342  // OOXTODO: XML_workbookParameter, "",
343  // OOXTODO: XML_xlm, ""
344  );
345  rWorkbook->writeEscaped( GetWithDefaultRangeSeparator( msSymbol ) );
346  rWorkbook->endElement( XML_definedName );
347 }
348 
349 void XclExpName::WriteBody( XclExpStream& rStrm )
350 {
351  sal_uInt16 nFmlaSize = mxTokArr ? mxTokArr->GetSize() : 0;
352 
353  rStrm << mnFlags // flags
354  << sal_uInt8( 0 ); // keyboard shortcut
355  mxName->WriteLenField( rStrm ); // length of name
356  rStrm << nFmlaSize // size of token array
357  << mnExtSheet // BIFF5/7: EXTSHEET index, BIFF8: not used
358  << mnXclTab // 1-based sheet index for local names
359  << sal_uInt32( 0 ); // length of menu/descr/help/status text
360  mxName->WriteFlagField( rStrm ); // BIFF8 flag field (no-op in <=BIFF7)
361  mxName->WriteBuffer( rStrm ); // character array of the name
362  if( mxTokArr )
363  mxTokArr->WriteArray( rStrm ); // token array without size
364 }
365 
368 static bool lcl_EnsureAbs3DToken( const SCTAB nTab, formula::FormulaToken* pTok, const bool bFix = true )
369 {
370  bool bFixRequired = false;
371  if ( !pTok || ( pTok->GetType() != formula::svSingleRef && pTok->GetType() != formula::svDoubleRef ) )
372  return bFixRequired;
373 
374  ScSingleRefData* pRef1 = pTok->GetSingleRef();
375  if ( !pRef1 )
376  return bFixRequired;
377 
378  ScSingleRefData* pRef2 = nullptr;
379  if ( pTok->GetType() == formula::svDoubleRef )
380  pRef2 = pTok->GetSingleRef2();
381 
382  if ( pRef1->IsTabRel() || !pRef1->IsFlag3D() )
383  {
384  bFixRequired = true;
385  if ( bFix )
386  {
387  if ( pRef1->IsTabRel() && nTab != SCTAB_GLOBAL )
388  pRef1->SetAbsTab( nTab + pRef1->Tab() ); //XLS requirement
389  if ( !pRef1->IsTabRel() )
390  {
391  pRef1->SetFlag3D( true ); //XLSX requirement
392  if ( pRef2 && !pRef2->IsTabRel() )
393  pRef2->SetFlag3D( pRef2->Tab() != pRef1->Tab() );
394  }
395  }
396  }
397 
398  if ( pRef2 && pRef2->IsTabRel() && !pRef1->IsTabRel() )
399  {
400  bFixRequired = true;
401  if ( bFix && nTab != SCTAB_GLOBAL )
402  {
403  pRef2->SetAbsTab( nTab + pRef2->Tab() );
404  pRef2->SetFlag3D( pRef2->Tab() != pRef1->Tab() );
405  }
406  }
407  return bFixRequired;
408 }
409 
411  XclExpRoot( rRoot ),
412  mnFirstUserIdx( 0 )
413 {
414 }
415 
417 {
420  CreateUserNames();
421 }
422 
423 sal_uInt16 XclExpNameManagerImpl::InsertName( SCTAB nTab, sal_uInt16 nScNameIdx, SCTAB nCurrTab )
424 {
425  sal_uInt16 nNameIdx = 0;
426  const ScRangeData* pData = nullptr;
427  ScRangeName* pRN = (nTab == SCTAB_GLOBAL) ? GetDoc().GetRangeName() : GetDoc().GetRangeName(nTab);
428  if (pRN)
429  pData = pRN->findByIndex(nScNameIdx);
430 
431  if (pData)
432  {
433  bool bEmulateGlobalRelativeTable = false;
434  const ScTokenArray* pCode = pData->GetCode();
435  if ( pCode
436  && nTab == SCTAB_GLOBAL
438  {
439  bEmulateGlobalRelativeTable = lcl_EnsureAbs3DToken( nTab, pCode->FirstToken(), /*bFix=*/false );
440  }
441  nNameIdx = FindNamedExp( bEmulateGlobalRelativeTable ? nCurrTab : nTab, pData->GetName() );
442  if (!nNameIdx)
443  nNameIdx = CreateName(nTab, *pData);
444  }
445 
446  return nNameIdx;
447 }
448 
449 sal_uInt16 XclExpNameManagerImpl::InsertBuiltInName( sal_Unicode cBuiltIn, const XclTokenArrayRef& xTokArr, const ScRange& aRange )
450 {
451  XclExpNameRef xName = new XclExpName( GetRoot(), cBuiltIn );
452  xName->SetTokenArray( xTokArr );
453  xName->SetLocalTab( aRange.aStart.Tab() );
455  xName->SetSymbol( sSymbol );
456  return Append( xName );
457 }
458 
459 sal_uInt16 XclExpNameManagerImpl::InsertBuiltInName( sal_Unicode cBuiltIn, const XclTokenArrayRef& xTokArr, SCTAB nScTab, const ScRangeList& rRangeList )
460 {
461  XclExpNameRef xName = new XclExpName( GetRoot(), cBuiltIn );
462  xName->SetTokenArray( xTokArr );
463  xName->SetLocalTab( nScTab );
464  OUString sSymbol;
466  xName->SetSymbol( sSymbol );
467  return Append( xName );
468 }
469 
471  const OUString& rName, const XclTokenArrayRef& xTokArr, SCTAB nScTab )
472 {
473  OSL_ENSURE( !rName.isEmpty(), "XclExpNameManagerImpl::InsertUniqueName - empty name" );
474  XclExpNameRef xName = new XclExpName( GetRoot(), GetUnusedName( rName ) );
475  xName->SetTokenArray( xTokArr );
476  xName->SetLocalTab( nScTab );
477  return Append( xName );
478 }
479 
480 sal_uInt16 XclExpNameManagerImpl::InsertRawName( const OUString& rName )
481 {
482  // empty name? may occur in broken external Calc tokens
483  if( rName.isEmpty() )
484  return 0;
485 
486  // try to find an existing NAME record, regardless of its type
487  for( size_t nListIdx = mnFirstUserIdx, nListSize = maNameList.GetSize(); nListIdx < nListSize; ++nListIdx )
488  {
489  XclExpNameRef xName = maNameList.GetRecord( nListIdx );
490  if( xName->IsGlobal() && (xName->GetOrigName() == rName) )
491  return static_cast< sal_uInt16 >( nListIdx + 1 );
492  }
493 
494  // create a new NAME record
495  XclExpNameRef xName = new XclExpName( GetRoot(), rName );
496  return Append( xName );
497 }
498 
499 sal_uInt16 XclExpNameManagerImpl::InsertMacroCall( const OUString& rMacroName, bool bVBasic, bool bFunc, bool bHidden )
500 {
501  // empty name? may occur in broken external Calc tokens
502  if( rMacroName.isEmpty() )
503  return 0;
504 
505  // try to find an existing NAME record
506  for( size_t nListIdx = mnFirstUserIdx, nListSize = maNameList.GetSize(); nListIdx < nListSize; ++nListIdx )
507  {
508  XclExpNameRef xName = maNameList.GetRecord( nListIdx );
509  if( xName->IsMacroCall( bVBasic, bFunc ) && (xName->GetOrigName() == rMacroName) )
510  return static_cast< sal_uInt16 >( nListIdx + 1 );
511  }
512 
513  // create a new NAME record
514  XclExpNameRef xName = new XclExpName( GetRoot(), rMacroName );
515  xName->SetMacroCall( bVBasic, bFunc );
516  xName->SetHidden( bHidden );
517 
518  // for sheet macros, add a #NAME! error
519  if( !bVBasic )
520  xName->SetTokenArray( GetFormulaCompiler().CreateErrorFormula( EXC_ERR_NAME ) );
521 
522  return Append( xName );
523 }
524 
525 const XclExpName* XclExpNameManagerImpl::GetName( sal_uInt16 nNameIdx ) const
526 {
527  OSL_ENSURE( maNameList.HasRecord( nNameIdx - 1 ), "XclExpNameManagerImpl::GetName - wrong record index" );
528  return maNameList.GetRecord( nNameIdx - 1 );
529 }
530 
532 {
533  maNameList.Save( rStrm );
534 }
535 
537 {
538  if( maNameList.IsEmpty() )
539  return;
540  sax_fastparser::FSHelperPtr& rWorkbook = rStrm.GetCurrentStream();
541  rWorkbook->startElement(XML_definedNames);
542  maNameList.SaveXml( rStrm );
543  rWorkbook->endElement( XML_definedNames );
544 }
545 
546 // private --------------------------------------------------------------------
547 
548 sal_uInt16 XclExpNameManagerImpl::FindNamedExp( SCTAB nTab, OUString sName )
549 {
550  NamedExpMap::key_type key(nTab, sName);
551  NamedExpMap::const_iterator itr = maNamedExpMap.find(key);
552  return (itr == maNamedExpMap.end()) ? 0 : itr->second;
553 }
554 
556  const OUString& rName, const OUString& sSymbol ) const
557 {
558  /* Get built-in index from the name. Special case: the database range
559  'unnamed' will be mapped to Excel's built-in '_FilterDatabase' name. */
560  sal_Unicode cBuiltIn = XclTools::GetBuiltInDefNameIndex( rName );
561 
562  if( cBuiltIn < EXC_BUILTIN_UNKNOWN )
563  {
564  // try to find the record in existing built-in NAME record list
565  for( size_t nPos = 0; nPos < mnFirstUserIdx; ++nPos )
566  {
567  XclExpNameRef xName = maNameList.GetRecord( nPos );
568  if( xName->GetBuiltInName() == cBuiltIn && xName->GetSymbol().replace(';', ',') == sSymbol.replace(';', ',') )
569  {
570  // tdf#112567 restore the original built-in names with non-localized separators
571  // TODO: support more localizations, if needed
572  if ( xName->GetSymbol() != sSymbol )
573  {
574  xName->SetSymbol(xName->GetSymbol().replace(';', ','));
575  }
576  return static_cast< sal_uInt16 >( nPos + 1 );
577  }
578  }
579  }
580  return 0;
581 }
582 
583 OUString XclExpNameManagerImpl::GetUnusedName( const OUString& rName ) const
584 {
585  OUString aNewName( rName );
586  sal_Int32 nAppIdx = 0;
587  bool bExist = true;
588  while( bExist )
589  {
590  // search the list of user-defined names
591  bExist = false;
592  for( size_t nPos = mnFirstUserIdx, nSize = maNameList.GetSize(); !bExist && (nPos < nSize); ++nPos )
593  {
594  XclExpNameRef xName = maNameList.GetRecord( nPos );
595  bExist = xName->GetOrigName() == aNewName;
596  // name exists -> create a new name "<originalname>_<counter>"
597  if( bExist )
598  aNewName = rName + "_" + OUString::number( ++nAppIdx );
599  }
600  }
601  return aNewName;
602 }
603 
604 sal_uInt16 XclExpNameManagerImpl::Append( XclExpName* pName )
605 {
606  if( maNameList.GetSize() == 0xFFFF )
607  return 0;
608  maNameList.AppendRecord( pName );
609  return static_cast< sal_uInt16 >( maNameList.GetSize() ); // 1-based
610 }
611 
612 sal_uInt16 XclExpNameManagerImpl::CreateName( SCTAB nTab, const ScRangeData& rRangeData )
613 {
614  const OUString& rName = rRangeData.GetName();
615 
616  /* #i38821# recursive names: first insert the (empty) name object,
617  otherwise a recursive call of this function from the formula compiler
618  with the same defined name will not find it and will create it again. */
619  size_t nOldListSize = maNameList.GetSize();
620  XclExpNameRef xName = new XclExpName( GetRoot(), rName );
621  if (nTab != SCTAB_GLOBAL)
622  xName->SetLocalTab(nTab);
623  sal_uInt16 nNameIdx = Append( xName );
624  // store the index of the NAME record in the lookup map
625  NamedExpMap::key_type key(nTab, rRangeData.GetName());
626  maNamedExpMap[key] = nNameIdx;
627 
628  /* Create the definition formula.
629  This may cause recursive creation of other defined names. */
630  if( const ScTokenArray* pScTokArr = const_cast< ScRangeData& >( rRangeData ).GetCode() )
631  {
632  XclTokenArrayRef xTokArr;
633  OUString sSymbol;
634  // MSO requires named ranges to have absolute sheet references
635  if ( rRangeData.HasType( ScRangeData::Type::AbsPos ) || rRangeData.HasType( ScRangeData::Type::AbsArea ) )
636  {
637  // Don't modify the actual document; use a temporary copy to create the export formulas.
638  std::unique_ptr<ScTokenArray> pTokenCopy( pScTokArr->Clone() );
639  lcl_EnsureAbs3DToken(nTab, pTokenCopy->FirstToken());
640 
641  xTokArr = GetFormulaCompiler().CreateFormula(EXC_FMLATYPE_NAME, *pTokenCopy);
642  if ( GetOutput() != EXC_OUTPUT_BINARY )
643  {
644  ScCompiler aComp(GetDoc(), rRangeData.GetPos(), *pTokenCopy,
646  aComp.CreateStringFromTokenArray( sSymbol );
647  }
648  }
649  else
650  {
651  xTokArr = GetFormulaCompiler().CreateFormula( EXC_FMLATYPE_NAME, *pScTokArr );
652  rRangeData.GetSymbol( sSymbol, ((GetOutput() == EXC_OUTPUT_BINARY) ?
654  }
655  xName->SetTokenArray( xTokArr );
656  xName->SetSymbol( sSymbol );
657 
658  /* Try to replace by existing built-in name - complete token array is
659  needed for comparison, and due to the recursion problem above this
660  cannot be done earlier. If a built-in name is found, the created NAME
661  record for this name and all following records in the list must be
662  deleted, otherwise they may contain wrong name list indexes. */
663  sal_uInt16 nBuiltInIdx = FindBuiltInNameIdx( rName, sSymbol );
664  if( nBuiltInIdx != 0 )
665  {
666  // delete the new NAME records
667  while( maNameList.GetSize() > nOldListSize )
669  // use index of the found built-in NAME record
670  key = NamedExpMap::key_type(nTab, rRangeData.GetName());
671  maNamedExpMap[key] = nNameIdx = nBuiltInIdx;
672  }
673  }
674 
675  return nNameIdx;
676 }
677 
679 {
680  ScDocument& rDoc = GetDoc();
681  XclExpTabInfo& rTabInfo = GetTabInfo();
682 
683  /* #i2394# built-in defined names must be sorted by the name of the
684  containing sheet. Example: SheetA!Print_Range must be stored *before*
685  SheetB!Print_Range, regardless of the position of SheetA in the document! */
686  for( SCTAB nScTabIdx = 0, nScTabCount = rTabInfo.GetScTabCount(); nScTabIdx < nScTabCount; ++nScTabIdx )
687  {
688  // find real sheet index from the nScTabIdx counter
689  SCTAB nScTab = rTabInfo.GetRealScTab( nScTabIdx );
690  // create NAME records for all built-in names of this sheet
691  if( rTabInfo.IsExportTab( nScTab ) )
692  {
693  // *** 1) print ranges *** ----------------------------------------
694 
695  if( rDoc.HasPrintRange() )
696  {
697  ScRangeList aRangeList;
698  for( sal_uInt16 nIdx = 0, nCount = rDoc.GetPrintRangeCount( nScTab ); nIdx < nCount; ++nIdx )
699  {
700  const ScRange* pPrintRange = rDoc.GetPrintRange( nScTab, nIdx );
701  if (!pPrintRange)
702  continue;
703  ScRange aRange( *pPrintRange );
704  // Calc document does not care about sheet index in print ranges
705  aRange.aStart.SetTab( nScTab );
706  aRange.aEnd.SetTab( nScTab );
707  aRange.PutInOrder();
708  aRangeList.push_back( aRange );
709  }
710  // create the NAME record (do not warn if ranges are shrunken)
711  GetAddressConverter().ValidateRangeList( aRangeList, false );
712  if( !aRangeList.empty() )
714  }
715 
716  // *** 2) print titles *** ----------------------------------------
717 
718  ScRangeList aTitleList;
719  // repeated columns
720  if( const ScRange* pColRange = rDoc.GetRepeatColRange( nScTab ) )
721  aTitleList.push_back( ScRange(
722  pColRange->aStart.Col(), 0, nScTab,
723  pColRange->aEnd.Col(), GetXclMaxPos().Row(), nScTab ) );
724  // repeated rows
725  if( const ScRange* pRowRange = rDoc.GetRepeatRowRange( nScTab ) )
726  aTitleList.push_back( ScRange(
727  0, pRowRange->aStart.Row(), nScTab,
728  GetXclMaxPos().Col(), pRowRange->aEnd.Row(), nScTab ) );
729  // create the NAME record
730  GetAddressConverter().ValidateRangeList( aTitleList, false );
731  if( !aTitleList.empty() )
733 
734  // *** 3) filter ranges *** ---------------------------------------
735 
736  if( GetBiff() == EXC_BIFF8 )
737  GetFilterManager().InitTabFilter( nScTab );
738  }
739  }
740 }
741 
743 {
744  std::vector<ScRangeData*> vEmulateAsLocalRange;
745  const ScRangeName& rNamedRanges = GetNamedRanges();
746  for (const auto& rEntry : rNamedRanges)
747  {
748  // skip definitions of shared formulas
749  if (!FindNamedExp(SCTAB_GLOBAL, rEntry.second->GetName()))
750  {
751  const ScTokenArray* pCode = rEntry.second->GetCode();
752  if ( pCode
753  && (rEntry.second->HasType( ScRangeData::Type::AbsPos ) || rEntry.second->HasType( ScRangeData::Type::AbsArea ))
754  && lcl_EnsureAbs3DToken( SCTAB_GLOBAL, pCode->FirstToken(), /*bFix=*/false ) )
755  {
756  vEmulateAsLocalRange.emplace_back(rEntry.second.get());
757  }
758  else
759  CreateName(SCTAB_GLOBAL, *rEntry.second);
760  }
761  }
762  //look at sheets containing local range names
763  ScRangeName::TabNameCopyMap rLocalNames;
764  GetDoc().GetAllTabRangeNames(rLocalNames);
765  for (const auto& [rTab, pRangeName] : rLocalNames)
766  {
767  for (const auto& rEntry : *pRangeName)
768  {
769  // skip definitions of shared formulas
770  if (!FindNamedExp(rTab, rEntry.second->GetName()))
771  CreateName(rTab, *rEntry.second);
772  }
773  }
774 
775  // Emulate relative global variables by creating a copy in each local range.
776  // Creating AFTER true local range names so that conflicting global names will be ignored.
777  for ( SCTAB nTab = 0; nTab < GetDoc().GetTableCount(); ++nTab )
778  {
779  for ( auto rangeDataItr : vEmulateAsLocalRange )
780  {
781  if ( !FindNamedExp(nTab, rangeDataItr->GetName()) )
782  CreateName(nTab, *rangeDataItr );
783  }
784  }
785 }
786 
788  XclExpRoot( rRoot ),
789  mxImpl( std::make_shared<XclExpNameManagerImpl>( rRoot ) )
790 {
791 }
792 
794 {
795 }
796 
798 {
799  mxImpl->Initialize();
800 }
801 
802 sal_uInt16 XclExpNameManager::InsertName( SCTAB nTab, sal_uInt16 nScNameIdx, SCTAB nCurrTab )
803 {
804  return mxImpl->InsertName( nTab, nScNameIdx, nCurrTab );
805 }
806 
807 sal_uInt16 XclExpNameManager::InsertBuiltInName( sal_Unicode cBuiltIn, const ScRange& rRange )
808 {
810  return mxImpl->InsertBuiltInName( cBuiltIn, xTokArr, rRange );
811 }
812 
813 sal_uInt16 XclExpNameManager::InsertBuiltInName( sal_Unicode cBuiltIn, const ScRangeList& rRangeList )
814 {
815  sal_uInt16 nNameIdx = 0;
816  if( !rRangeList.empty() )
817  {
819  nNameIdx = mxImpl->InsertBuiltInName( cBuiltIn, xTokArr, rRangeList.front().aStart.Tab(), rRangeList );
820  }
821  return nNameIdx;
822 }
823 
825  const OUString& rName, const XclTokenArrayRef& xTokArr, SCTAB nScTab )
826 {
827  return mxImpl->InsertUniqueName( rName, xTokArr, nScTab );
828 }
829 
830 sal_uInt16 XclExpNameManager::InsertRawName( const OUString& rName )
831 {
832  return mxImpl->InsertRawName( rName );
833 }
834 
835 sal_uInt16 XclExpNameManager::InsertMacroCall( const OUString& rMacroName, bool bVBasic, bool bFunc, bool bHidden )
836 {
837  return mxImpl->InsertMacroCall( rMacroName, bVBasic, bFunc, bHidden );
838 }
839 
840 const OUString& XclExpNameManager::GetOrigName( sal_uInt16 nNameIdx ) const
841 {
842  const XclExpName* pName = mxImpl->GetName( nNameIdx );
843  return pName ? pName->GetOrigName() : EMPTY_OUSTRING;
844 }
845 
846 SCTAB XclExpNameManager::GetScTab( sal_uInt16 nNameIdx ) const
847 {
848  const XclExpName* pName = mxImpl->GetName( nNameIdx );
849  return pName ? pName->GetScTab() : SCTAB_GLOBAL;
850 }
851 
852 bool XclExpNameManager::IsVolatile( sal_uInt16 nNameIdx ) const
853 {
854  const XclExpName* pName = mxImpl->GetName( nNameIdx );
855  return pName && pName->IsVolatile();
856 }
857 
859 {
860  mxImpl->Save( rStrm );
861 }
862 
864 {
865  mxImpl->SaveXml( rStrm );
866 }
867 
868 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
bool IsTabRel() const
Definition: refdata.hxx:70
const sal_uInt16 EXC_NAME_VB
Definition: xlname.hxx:36
const sal_uInt16 EXC_NAME_HIDDEN
Definition: xlname.hxx:34
XclExpFilterManager & GetFilterManager() const
Returns the filter manager.
Definition: xeroot.cxx:153
virtual void Save(XclExpStream &rStrm) override
Writes the complete record list.
Definition: xerecord.hxx:376
virtual ~XclExpNameManager() override
Definition: xename.cxx:793
#define DBG_ERROR_BIFF()
Definition: xltools.hxx:31
XclExpNameList::RecordRefType XclExpNameRef
Definition: xename.cxx:151
SC_DLLPUBLIC const ScRange * GetRepeatColRange(SCTAB nTab)
Definition: document.cxx:6287
ScAddress aStart
Definition: address.hxx:500
SC_DLLPUBLIC bool HasPrintRange()
Definition: document.cxx:6250
bool IsExportTab(SCTAB nScTab) const
Returns true, if the specified Calc sheet will be exported.
Definition: xelink.cxx:771
ScRangeName & GetNamedRanges() const
Returns the defined names container of the Calc document.
Definition: xlroot.cxx:302
#define EMPTY_OUSTRING
Definition: global.hxx:215
void InitTabFilter(SCTAB nScTab)
Creates the filter records for the specified sheet.
Definition: excrecds.cxx:1085
This class is used to export Excel record streams.
Definition: xestream.hxx:71
SCROW Row() const
Definition: address.hxx:262
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xerecord.hxx:383
bool IsVolatile(sal_uInt16 nNameIdx) const
Returns true, if the specified defined name is volatile.
Definition: xename.cxx:852
Single reference (one address) into the sheet.
Definition: refdata.hxx:30
XclStrFlags
Flags used to specify import/export mode of strings.
Definition: xlstring.hxx:29
std::unique_ptr< ContentProperties > pData
void AppendRecord(RecType *pRec)
Appends a record to the list.
Definition: xerecord.hxx:349
void Format(OUString &, ScRefFlags nFlags, const ScDocument &, formula::FormulaGrammar::AddressConvention eConv=formula::FormulaGrammar::CONV_OOO, sal_Unicode cDelimiter=0, bool bFullAddressNotation=false) const
Definition: rangelst.cxx:146
NamedExpMap maNamedExpMap
Maps Calc's named range to Excel's NAME records.
Definition: xename.cxx:189
XclExpNameMgrImplRef mxImpl
Definition: xename.hxx:71
const sal_uInt16 EXC_ID_NAME
Definition: xlname.hxx:29
virtual void Save(XclExpStream &rStrm) override
Writes the entire list of NAME records.
Definition: xename.cxx:858
sal_uInt16 FindBuiltInNameIdx(const OUString &rName, const OUString &sSymbol) const
Returns the index of an existing built-in NAME record with the passed definition, otherwise 0...
Definition: xename.cxx:555
SC_DLLPUBLIC ScRangeName * GetRangeName(SCTAB nTab) const
Definition: documen3.cxx:168
static bool lcl_EnsureAbs3DToken(const SCTAB nTab, formula::FormulaToken *pTok, const bool bFix=true)
Returns true (needed fixing) if FormulaToken was not absolute and 3D.
Definition: xename.cxx:368
XclExpFormulaCompiler & GetFormulaCompiler() const
Returns the formula compiler to produce formula token arrays.
Definition: xeroot.cxx:87
ScAddress aEnd
Definition: address.hxx:501
void set_flag(Type &rnBitField, Type nMask, bool bSet=true)
Sets or clears (according to bSet) all set bits of nMask in rnBitField.
Definition: ftools.hxx:93
SCTAB GetScTab(sal_uInt16 nNameIdx) const
Returns the Calc sheet of a local defined name, or SCTAB_GLOBAL for global defined names...
Definition: xename.cxx:846
std::shared_ptr< T > make_shared(Args &&...args)
ScDocument & GetDoc() const
Returns reference to the destination document (import) or source document (export).
Definition: xlroot.cxx:276
void CreateStringFromTokenArray(OUString &rFormula)
::std::map< SCTAB, const ScRangeName * > TabNameCopyMap
Map that stores non-managed pointers to ScRangeName instances.
Definition: rangenam.hxx:194
static OUString GetBuiltInDefNameXml(sal_Unicode cBuiltIn)
Returns the Excel built-in name with OOXML prefix Adds the "_xlnm." prefix to the representation ret...
Definition: xltools.cxx:500
const sal_uInt16 EXC_NAME_BUILTIN
Definition: xlname.hxx:39
FuncFlags mnFlags
Information about all parameters.
const sal_uInt16 EXC_NAME_DEFAULT
Definition: xlname.hxx:33
sal_uInt16 sal_Unicode
Access to global data from other classes.
Definition: xeroot.hxx:113
MS Excel 4.0.
Definition: xlconst.hxx:35
SC_DLLPUBLIC SCTAB GetTableCount() const
Definition: document.cxx:314
sal_uInt16 InsertUniqueName(const OUString &rName, const XclTokenArrayRef &xTokArr, SCTAB nScTab)
Inserts a new defined name.
Definition: xename.cxx:824
sal_uInt16 InsertBuiltInName(sal_Unicode cBuiltIn, const XclTokenArrayRef &xTokArr, SCTAB nScTab, const ScRangeList &aRangeList)
Inserts a new built-in defined name.
Definition: xename.cxx:459
int nCount
virtual const ScSingleRefData * GetSingleRef() const
void push_back(const ScRange &rRange)
Definition: rangelst.cxx:1144
SCTAB Tab() const
Definition: address.hxx:271
SC_DLLPUBLIC const ScRange * GetPrintRange(SCTAB nTab, sal_uInt16 nPos)
Definition: document.cxx:6279
void GetName(OUString &rName) const
Definition: rangenam.hxx:111
sax_fastparser::FSHelperPtr & GetCurrentStream()
Definition: xestream.cxx:910
const SCTAB SCTAB_GLOBAL
An invalid Calc sheet index, for common use.
Definition: xlconst.hxx:75
const sal_Unicode EXC_BUILTIN_UNKNOWN
Definition: xlname.hxx:62
bool HasRecord(size_t nPos) const
Returns true, if the passed index points to an exiting record.
Definition: xerecord.hxx:331
bool empty() const
Definition: rangelst.hxx:89
XclExpNameManagerImpl(const XclExpRoot &rRoot)
Definition: xename.cxx:410
void SetTab(SCTAB nTabP)
Definition: address.hxx:283
sal_uInt16 char * pName
Definition: callform.cxx:58
MS Excel 5.0, MS Excel 7.0 (95)
Definition: xlconst.hxx:36
SC_DLLPUBLIC sal_uInt16 GetPrintRangeCount(SCTAB nTab)
Definition: document.cxx:6271
XclOutput GetOutput() const
Returns the current output format of the importer/exporter.
Definition: xlroot.hxx:143
static sal_Unicode GetBuiltInDefNameIndex(const OUString &rDefName)
Returns the Excel built-in name index of the passed defined name from Calc.
Definition: xltools.cxx:507
XclExpAddressConverter & GetAddressConverter() const
Returns the address converter.
Definition: xeroot.cxx:81
const XclExpName * GetName(sal_uInt16 nNameIdx) const
Returns the NAME record at the specified position or 0 on error.
Definition: xename.cxx:525
SC_DLLPUBLIC void GetSymbol(OUString &rSymbol, const formula::FormulaGrammar::Grammar eGrammar=formula::FormulaGrammar::GRAM_DEFAULT) const
Definition: rangenam.cxx:246
sal_uInt16 InsertMacroCall(const OUString &rMacroName, bool bVBasic, bool bFunc, bool bHidden)
Searches or inserts a defined name describing a macro name.
Definition: xename.cxx:499
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xename.cxx:863
void SetFlag3D(bool bVal)
Definition: refdata.hxx:90
sal_uInt16 InsertRawName(const OUString &rName)
Returns index of an existing name, or creates a name without definition.
Definition: xename.cxx:830
void CreateBuiltInNames()
Creates NAME records for all built-in names in the document.
Definition: xename.cxx:678
void RemoveRecord(size_t nPos)
Removes the record at the specified position from the list.
Definition: xerecord.hxx:370
const OUString & GetOrigName(sal_uInt16 nNameIdx) const
Returns the Calc sheet of a local defined name, or SCTAB_GLOBAL for global defined names...
Definition: xename.cxx:840
SC_DLLPUBLIC OUString Format(const ScDocument &rDocument, ScRefFlags nFlags=ScRefFlags::ZERO, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, bool bFullAddressNotation=false) const
Returns string with formatted cell range from aStart to aEnd, according to provided address conventio...
Definition: address.cxx:2203
void Save(XclExpStream &rStrm)
Writes the entire list of NAME records.
Definition: xename.cxx:531
const sal_Unicode EXC_BUILTIN_PRINTTITLES
Definition: xlname.hxx:55
bool get_flag(Type nBitField, Type nMask)
Returns true, if at least one of the bits set in nMask is set in nBitField.
Definition: ftools.hxx:73
Stores the correct Excel sheet index for each Calc sheet.
Definition: xelink.hxx:62
XclExpRecordList< XclExpName > XclExpNameList
Definition: xename.cxx:150
XclExpNameManager & GetNameManager() const
Returns the buffer that contains internal defined names.
Definition: xeroot.cxx:141
XclExpTabInfo & GetTabInfo() const
Returns the buffer for Calc->Excel sheet index conversion.
Definition: xeroot.cxx:75
FormulaToken * FirstToken() const
const sal_Unicode EXC_BUILTIN_PRINTAREA
Definition: xlname.hxx:54
SC_DLLPUBLIC ScRangeData * findByIndex(sal_uInt16 i) const
Definition: rangenam.cxx:694
void SetAbsTab(SCTAB nVal)
Definition: refdata.cxx:93
std::shared_ptr< FastSerializerHelper > FSHelperPtr
sal_uInt16 CreateName(SCTAB nTab, const ScRangeData &rRangeData)
Creates a new NAME record for the passed user-defined name.
Definition: xename.cxx:612
bool HasType(Type nType) const
Definition: rangenam.hxx:177
std::shared_ptr< XclTokenArray > XclTokenArrayRef
Definition: xlformula.hxx:417
SCTAB Tab() const
Definition: refdata.cxx:254
bool IsFlag3D() const
Definition: refdata.hxx:91
SCCOL Col() const
Definition: address.hxx:267
const XclExpRoot & GetRoot() const
Returns this root instance - for code readability in derived classes.
Definition: xeroot.hxx:119
sal_uInt16 InsertBuiltInName(sal_Unicode cBuiltIn, const ScRange &rRange)
Inserts a new built-in defined name, referring to the passed sheet range.
Definition: xename.cxx:807
void SaveXml(XclExpXmlStream &rStrm)
Definition: xename.cxx:536
SCTAB GetScTabCount() const
Returns the number of Calc sheets.
Definition: xelink.hxx:90
virtual void WriteBody(XclExpStream &rStrm)
Writes the body of the record (without record header).
Definition: xerecord.cxx:146
RecType * GetRecord(size_t nPos) const
Returns reference to an existing record or empty reference on error.
Definition: xerecord.hxx:334
Implementation class of the name manager.
Definition: xename.cxx:115
SC_DLLPUBLIC void PutInOrder()
Definition: address.cxx:1573
const ScAddress & GetPos() const
Definition: rangenam.hxx:114
XclExpNameList maNameList
Definition: xename.cxx:190
sal_uInt16 InsertUniqueName(const OUString &rName, const XclTokenArrayRef &xTokArr, SCTAB nScTab)
Inserts a new defined name.
Definition: xename.cxx:470
virtual const ScSingleRefData * GetSingleRef2() const
SC_DLLPUBLIC const ScRange * GetRepeatRowRange(SCTAB nTab)
Definition: document.cxx:6295
void Initialize()
Creates NAME records for built-in and user defined names.
Definition: xename.cxx:416
sal_uInt16 InsertMacroCall(const OUString &rMacroName, bool bVBasic, bool bFunc, bool bHidden=false)
Searches or inserts a defined name describing a macro name.
Definition: xename.cxx:835
unsigned char sal_uInt8
const sal_uInt8 EXC_ERR_NAME
Definition: xlconst.hxx:109
sal_uInt16 Append(XclExpName *pName)
Appends a new NAME record to the record list.
Definition: xename.cxx:604
sal_uInt16 InsertName(SCTAB nTab, sal_uInt16 nScNameIdx, SCTAB nCurrTab)
Inserts the Calc name with the passed index and returns the Excel NAME index.
Definition: xename.cxx:423
OUString aName
Always use UCS-2 characters (default: try to compress). BIFF8 only.
FormulaToken ** GetCode() const
const ScAddress & GetXclMaxPos() const
Returns the highest possible cell address in an Excel document (using current BIFF version)...
Definition: xlroot.hxx:245
SC_DLLPUBLIC ScRefFlags Parse(const OUString &, const ScDocument &, const ScAddress::Details &rDetails=ScAddress::detailsOOOa1, ScAddress::ExternalInfo *pExtInfo=nullptr, const css::uno::Sequence< css::sheet::ExternalLinkInfo > *pExternalLinks=nullptr, const OUString *pErrRef=nullptr)
Definition: address.cxx:1733
size_t mnFirstUserIdx
List of NAME records.
Definition: xename.cxx:191
sal_uInt16 Append(XclExpNameRef const &rxName)
Definition: xename.cxx:173
XclTokenArrayRef CreateFormula(XclFormulaType eType, const ScTokenArray &rScTokArr, const ScAddress *pScBasePos=nullptr, XclExpRefLog *pRefLog=nullptr)
Creates and returns the token array of a formula.
Definition: xeformula.cxx:2637
XclBiff GetBiff() const
Returns the current BIFF version of the importer/exporter.
Definition: xlroot.hxx:141
OUString GetUnusedName(const OUString &rName) const
Returns an unused name for the passed name.
Definition: xename.cxx:583
void CreateUserNames()
Creates NAME records for all user-defined names in the document.
Definition: xename.cxx:742
void Initialize()
Creates NAME records for built-in and user defined names.
Definition: xename.cxx:797
const sal_uInt16 EXC_NAME_GLOBAL
BIFF2 function/command flag.
Definition: xlname.hxx:45
size_t GetSize() const
Definition: xerecord.hxx:328
Data validation.
Definition: xlformula.hxx:167
XclExpNameManager(const XclExpRoot &rRoot)
Definition: xename.cxx:787
This class provides methods to create an XclExpString.
Definition: xehelper.hxx:212
sal_uInt16 FindNamedExp(SCTAB nTab, OUString sName)
Definition: xename.cxx:548
sal_uInt16 InsertName(SCTAB nTab, sal_uInt16 nScNameIdx, SCTAB nCurrTab)
Inserts the Calc name with the passed index and returns the Excel NAME index.
Definition: xename.cxx:802
void ValidateRangeList(ScRangeList &rScRanges, bool bWarn)
Checks and eventually crops the cell ranges to valid dimensions.
Definition: xehelper.cxx:255
sal_uInt16 InsertRawName(const OUString &rName)
Returns index of an existing name, or creates a name without definition.
Definition: xename.cxx:480
ScRange & front()
Definition: rangelst.hxx:93
static XclExpStringRef CreateString(const XclExpRoot &rRoot, const OUString &rString, XclStrFlags nFlags=XclStrFlags::NONE, sal_uInt16 nMaxLen=EXC_STR_MAXLEN)
Creates a new unformatted string from the passed string.
Definition: xehelper.cxx:526
std::shared_ptr< XclExpString > XclExpStringRef
Definition: xeroot.hxx:36
ScRefFlags
Definition: address.hxx:145
SCTAB GetRealScTab(SCTAB nSortedScTab) const
Returns the Calc sheet index of the nSortedTab-th entry in the sorted sheet names list...
Definition: xelink.cxx:816
bool IsEmpty() const
Definition: xerecord.hxx:327
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: xerecord.cxx:150
void SvStream & rStrm
const sal_uInt16 EXC_NAME_PROC
Definition: xlname.hxx:37
SC_DLLPUBLIC void GetAllTabRangeNames(ScRangeName::TabNameCopyMap &rRangeNames) const
Get all range names that are local to each table.
Definition: documen3.cxx:102
StackVar GetType() const
ScTokenArray * GetCode()
Definition: rangenam.hxx:120
const sal_uInt16 EXC_NAME_FUNC
Definition: xlname.hxx:35
virtual void SaveXml(XclExpXmlStream &rStrm)
Definition: xerecord.cxx:40
const sal_Unicode EXC_BUILTIN_FILTERDATABASE
Definition: xlname.hxx:61
::std::map< ::std::pair< SCTAB, OUString >, sal_uInt16 > NamedExpMap
Definition: xename.cxx:153
Base class for single records with any content.
Definition: xerecord.hxx:143
sal_uInt16 nPos
sal_Int16 SCTAB
Definition: types.hxx:23
static OUString GetXclBuiltInDefName(sal_Unicode cBuiltIn)
Returns the raw English UI representation of a built-in defined name used in NAME records...
Definition: xltools.cxx:482