LibreOffice Module sc (master)  1
tokstack.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 <tokstack.hxx>
21 #include <scmatrix.hxx>
22 
23 #include <svl/sharedstringpool.hxx>
24 #include <sal/log.hxx>
25 #include <osl/diagnose.h>
26 
27 #include <algorithm>
28 #include <string.h>
29 
30 const sal_uInt16 TokenPool::nScTokenOff = 8192;
31 
33  : pStack( new TokenId[ nSize ] )
34 {
35  Reset();
36 }
37 
39 {
40 }
41 
42 // !ATTENTION!": to the outside the numbering starts with 1!
43 // !ATTENTION!": SC-Token are stored with an offset nScTokenOff
44 // -> to distinguish from other tokens
45 
47  mrStringPool(rSPool)
48 {
49  // pool for Id-sequences
50  nP_Id = 256;
51  pP_Id.reset( new sal_uInt16[ nP_Id ] );
52 
53  // pool for Ids
54  nElement = 32;
55  pElement.reset( new sal_uInt16[ nElement ] );
56  pType.reset( new E_TYPE[ nElement ] );
57  pSize.reset( new sal_uInt16[ nElement ] );
58  nP_IdLast = 0;
59 
60  nP_Matrix = 16;
61  ppP_Matrix.reset( new ScMatrix*[ nP_Matrix ] );
62  memset( ppP_Matrix.get(), 0, sizeof( ScMatrix* ) * nP_Matrix );
63 
64  Reset();
65 }
66 
68 {
69  ClearMatrix();
70 }
71 
73 static sal_uInt16 lcl_canGrow( sal_uInt16 nOld )
74 {
75  if (!nOld)
76  return 1;
77  if (nOld == SAL_MAX_UINT16)
78  return 0;
79  sal_uInt32 nNew = ::std::max( static_cast<sal_uInt32>(nOld) * 2,
80  static_cast<sal_uInt32>(nOld) + 1);
81  if (nNew > SAL_MAX_UINT16)
82  nNew = SAL_MAX_UINT16;
83  if (nNew - 1 < nOld)
84  nNew = 0;
85  return static_cast<sal_uInt16>(nNew);
86 }
87 
89 {
90  sal_uInt16 nP_IdNew = lcl_canGrow( nP_Id);
91  if (!nP_IdNew)
92  return false;
93 
94  sal_uInt16* pP_IdNew = new (::std::nothrow) sal_uInt16[ nP_IdNew ];
95  if (!pP_IdNew)
96  return false;
97 
98  for( sal_uInt16 nL = 0 ; nL < nP_Id ; nL++ )
99  pP_IdNew[ nL ] = pP_Id[ nL ];
100 
101  nP_Id = nP_IdNew;
102 
103  pP_Id.reset( pP_IdNew );
104  return true;
105 }
106 
108 {
109  // Last possible ID to be assigned somewhere is nElementCurrent+1
110  if (nElementCurrent + 1 == nScTokenOff - 1)
111  {
112  SAL_WARN("sc.filter","TokenPool::CheckElementOrGrow - last possible ID " << nElementCurrent+1);
113  return false;
114  }
115 
116  if (nElementCurrent >= nElement)
117  return GrowElement();
118 
119  return true;
120 }
121 
123 {
124  sal_uInt16 nElementNew = lcl_canGrow( nElement);
125  if (!nElementNew)
126  return false;
127 
128  std::unique_ptr<sal_uInt16[]> pElementNew(new (::std::nothrow) sal_uInt16[ nElementNew ]);
129  std::unique_ptr<E_TYPE[]> pTypeNew(new (::std::nothrow) E_TYPE[ nElementNew ]);
130  std::unique_ptr<sal_uInt16[]> pSizeNew(new (::std::nothrow) sal_uInt16[ nElementNew ]);
131  if (!pElementNew || !pTypeNew || !pSizeNew)
132  {
133  return false;
134  }
135 
136  for( sal_uInt16 nL = 0 ; nL < nElement ; nL++ )
137  {
138  pElementNew[ nL ] = pElement[ nL ];
139  pTypeNew[ nL ] = pType[ nL ];
140  pSizeNew[ nL ] = pSize[ nL ];
141  }
142 
143  nElement = nElementNew;
144 
145  pElement = std::move( pElementNew );
146  pType = std::move( pTypeNew );
147  pSize = std::move( pSizeNew );
148  return true;
149 }
150 
152 {
153  sal_uInt16 nNewSize = lcl_canGrow( nP_Matrix);
154  if (!nNewSize)
155  return false;
156 
157  ScMatrix** ppNew = new (::std::nothrow) ScMatrix*[ nNewSize ];
158  if (!ppNew)
159  return false;
160 
161  memset( ppNew, 0, sizeof( ScMatrix* ) * nNewSize );
162  for( sal_uInt16 nL = 0 ; nL < nP_Matrix ; nL++ )
163  ppNew[ nL ] = ppP_Matrix[ nL ];
164 
165  ppP_Matrix.reset( ppNew );
166  nP_Matrix = nNewSize;
167  return true;
168 }
169 
170 bool TokenPool::GetElement( const sal_uInt16 nId, ScTokenArray* pScToken )
171 {
172  if (nId >= nElementCurrent)
173  {
174  SAL_WARN("sc.filter","TokenPool::GetElement - Id too large, " << nId << " >= " << nElementCurrent);
175  return false;
176  }
177 
178  bool bRet = true;
179  if( pType[ nId ] == T_Id )
180  bRet = GetElementRek( nId, pScToken );
181  else
182  {
183  switch( pType[ nId ] )
184  {
185  case T_Str:
186  {
187  sal_uInt16 n = pElement[ nId ];
188  auto* p = ppP_Str.getIfInRange( n );
189  if (p)
190  pScToken->AddString(mrStringPool.intern(**p));
191  else
192  bRet = false;
193  }
194  break;
195  case T_D:
196  {
197  sal_uInt16 n = pElement[ nId ];
198  if (n < pP_Dbl.m_writemark)
199  pScToken->AddDouble( pP_Dbl[ n ] );
200  else
201  bRet = false;
202  }
203  break;
204  case T_Err:
205  break;
206 /* TODO: in case we had FormulaTokenArray::AddError() */
207 #if 0
208  {
209  sal_uInt16 n = pElement[ nId ];
210  if (n < nP_Err)
211  pScToken->AddError( pP_Err[ n ] );
212  else
213  bRet = false;
214  }
215 #endif
216  case T_RefC:
217  {
218  sal_uInt16 n = pElement[ nId ];
219  auto p = ppP_RefTr.getIfInRange(n);
220  if (p)
221  pScToken->AddSingleReference( **p );
222  else
223  bRet = false;
224  }
225  break;
226  case T_RefA:
227  {
228  sal_uInt16 n = pElement[ nId ];
229  if (n < ppP_RefTr.m_writemark && ppP_RefTr[ n ] && n+1 < ppP_RefTr.m_writemark && ppP_RefTr[ n + 1 ])
230  {
231  ScComplexRefData aScComplexRefData;
232  aScComplexRefData.Ref1 = *ppP_RefTr[ n ];
233  aScComplexRefData.Ref2 = *ppP_RefTr[ n + 1 ];
234  pScToken->AddDoubleReference( aScComplexRefData );
235  }
236  else
237  bRet = false;
238  }
239  break;
240  case T_RN:
241  {
242  sal_uInt16 n = pElement[nId];
243  if (n < maRangeNames.size())
244  {
245  const RangeName& r = maRangeNames[n];
246  pScToken->AddRangeName(r.mnIndex, r.mnSheet);
247  }
248  }
249  break;
250  case T_Ext:
251  {
252  sal_uInt16 n = pElement[ nId ];
253  auto p = ppP_Ext.getIfInRange(n);
254 
255  if( p )
256  {
257  if( (*p)->eId == ocEuroConvert )
258  pScToken->AddOpCode( (*p)->eId );
259  else
260  pScToken->AddExternal( (*p)->aText, (*p)->eId );
261  }
262  else
263  bRet = false;
264  }
265  break;
266  case T_Nlf:
267  {
268  sal_uInt16 n = pElement[ nId ];
269  auto p = ppP_Nlf.getIfInRange(n);
270 
271  if( p )
272  pScToken->AddColRowName( **p );
273  else
274  bRet = false;
275  }
276  break;
277  case T_Matrix:
278  {
279  sal_uInt16 n = pElement[ nId ];
280  ScMatrix* p = ( n < nP_Matrix )? ppP_Matrix[ n ] : nullptr;
281 
282  if( p )
283  pScToken->AddMatrix( p );
284  else
285  bRet = false;
286  }
287  break;
288  case T_ExtName:
289  {
290  sal_uInt16 n = pElement[nId];
291  if (n < maExtNames.size())
292  {
293  const ExtName& r = maExtNames[n];
295  }
296  else
297  bRet = false;
298  }
299  break;
300  case T_ExtRefC:
301  {
302  sal_uInt16 n = pElement[nId];
303  if (n < maExtCellRefs.size())
304  {
305  const ExtCellRef& r = maExtCellRefs[n];
307  }
308  else
309  bRet = false;
310  }
311  break;
312  case T_ExtRefA:
313  {
314  sal_uInt16 n = pElement[nId];
315  if (n < maExtAreaRefs.size())
316  {
317  const ExtAreaRef& r = maExtAreaRefs[n];
319  }
320  else
321  bRet = false;
322  }
323  break;
324  default:
325  OSL_FAIL("-TokenPool::GetElement(): undefined state!?");
326  bRet = false;
327  }
328  }
329  return bRet;
330 }
331 
332 bool TokenPool::GetElementRek( const sal_uInt16 nId, ScTokenArray* pScToken )
333 {
334 #ifdef DBG_UTIL
335  m_nRek++;
336  OSL_ENSURE(m_nRek <= nP_Id, "*TokenPool::GetElement(): recursion loops!?");
337 #endif
338 
339  OSL_ENSURE( nId < nElementCurrent, "*TokenPool::GetElementRek(): nId >= nElementCurrent" );
340 
341  if (nId >= nElementCurrent)
342  {
343  SAL_WARN("sc.filter", "*TokenPool::GetElementRek(): nId >= nElementCurrent");
344 #ifdef DBG_UTIL
345  m_nRek--;
346 #endif
347  return false;
348  }
349 
350  if (pType[ nId ] != T_Id)
351  {
352  SAL_WARN("sc.filter", "-TokenPool::GetElementRek(): pType[ nId ] != T_Id");
353 #ifdef DBG_UTIL
354  m_nRek--;
355 #endif
356  return false;
357  }
358 
359  bool bRet = true;
360  sal_uInt16 nCnt = pSize[ nId ];
361  sal_uInt16 nFirstId = pElement[ nId ];
362  if (nFirstId >= nP_Id)
363  {
364  SAL_WARN("sc.filter", "TokenPool::GetElementRek: nFirstId >= nP_Id");
365  nCnt = 0;
366  bRet = false;
367  }
368  sal_uInt16* pCurrent = nCnt ? &pP_Id[ nFirstId ] : nullptr;
369  if (nCnt > nP_Id - nFirstId)
370  {
371  SAL_WARN("sc.filter", "TokenPool::GetElementRek: nCnt > nP_Id - nFirstId");
372  nCnt = nP_Id - nFirstId;
373  bRet = false;
374  }
375  for( ; nCnt > 0 ; nCnt--, pCurrent++ )
376  {
377  assert(pCurrent);
378  if( *pCurrent < nScTokenOff )
379  {// recursion or not?
380  if (*pCurrent >= nElementCurrent)
381  {
382  SAL_WARN("sc.filter", "TokenPool::GetElementRek: *pCurrent >= nElementCurrent");
383  bRet = false;
384  }
385  else
386  {
387  if (pType[ *pCurrent ] == T_Id)
388  bRet = GetElementRek( *pCurrent, pScToken );
389  else
390  bRet = GetElement( *pCurrent, pScToken );
391  }
392  }
393  else // elementary SC_Token
394  pScToken->AddOpCode( static_cast<DefTokenId>( *pCurrent - nScTokenOff ) );
395  }
396 
397 #ifdef DBG_UTIL
398  m_nRek--;
399 #endif
400  return bRet;
401 }
402 
404 {
405  rId = static_cast<TokenId>( nElementCurrent + 1 );
406 
407  if (!CheckElementOrGrow())
408  return;
409 
410  pElement[ nElementCurrent ] = nP_IdLast; // Start of Token-sequence
411  pType[ nElementCurrent ] = T_Id; // set Typeinfo
413  // write from nP_IdLast to nP_IdCurrent-1 -> length of the sequence
414 
415  nElementCurrent++; // start value for next sequence
416  nP_IdLast = nP_IdCurrent;
417 }
418 
419 TokenId TokenPool::Store( const double& rDouble )
420 {
421  if (!CheckElementOrGrow())
422  return static_cast<const TokenId>(nElementCurrent+1);
423 
425  if (!pP_Dbl.Grow())
426  return static_cast<const TokenId>(nElementCurrent+1);
427 
428  pElement[ nElementCurrent ] = pP_Dbl.m_writemark; // Index in Double-Array
429  pType[ nElementCurrent ] = T_D; // set Typeinfo Double
430 
431  pP_Dbl[ pP_Dbl.m_writemark ] = rDouble;
432 
433  pSize[ nElementCurrent ] = 1; // does not matter
434 
435  nElementCurrent++;
437 
438  return static_cast<const TokenId>(nElementCurrent); // return old value + 1!
439 }
440 
441 TokenId TokenPool::Store( const sal_uInt16 nIndex )
442 {
443  return StoreName(nIndex, -1);
444 }
445 
446 TokenId TokenPool::Store( const OUString& rString )
447 {
448  // mostly copied to Store( const char* ), to avoid a temporary string
449  if (!CheckElementOrGrow())
450  return static_cast<const TokenId>(nElementCurrent+1);
451 
453  if (!ppP_Str.Grow())
454  return static_cast<const TokenId>(nElementCurrent+1);
455 
456  pElement[ nElementCurrent ] = ppP_Str.m_writemark; // Index in String-Array
457  pType[ nElementCurrent ] = T_Str; // set Typeinfo String
458 
459  // create String
460  if( !ppP_Str[ ppP_Str.m_writemark ] )
461  //...but only, if it does not exist already
462  ppP_Str[ ppP_Str.m_writemark ].reset( new OUString( rString ) );
463  else
464  //...copy otherwise
465  *ppP_Str[ ppP_Str.m_writemark ] = rString;
466 
467  /* attention truncate to 16 bits */
468  pSize[ nElementCurrent ] = static_cast<sal_uInt16>(ppP_Str[ ppP_Str.m_writemark ]->getLength());
469 
470  nElementCurrent++;
472 
473  return static_cast<const TokenId>(nElementCurrent); // return old value + 1!
474 }
475 
477 {
478  if (!CheckElementOrGrow())
479  return static_cast<const TokenId>(nElementCurrent+1);
480 
482  if (!ppP_RefTr.Grow())
483  return static_cast<const TokenId>(nElementCurrent+1);
484 
486  pType[ nElementCurrent ] = T_RefC; // set Typeinfo Cell-Ref
487 
489  ppP_RefTr[ ppP_RefTr.m_writemark ].reset( new ScSingleRefData( rTr ) );
490  else
491  *ppP_RefTr[ ppP_RefTr.m_writemark ] = rTr;
492 
493  nElementCurrent++;
495 
496  return static_cast<const TokenId>(nElementCurrent); // return old value + 1!
497 }
498 
500 {
501  if (!CheckElementOrGrow())
502  return static_cast<const TokenId>(nElementCurrent+1);
503 
505  if (!ppP_RefTr.Grow(2))
506  return static_cast<const TokenId>(nElementCurrent+1);
507 
509  pType[ nElementCurrent ] = T_RefA; // setTypeinfo Area-Ref
510 
512  ppP_RefTr[ ppP_RefTr.m_writemark ].reset( new ScSingleRefData( rTr.Ref1 ) );
513  else
516 
518  ppP_RefTr[ ppP_RefTr.m_writemark ].reset( new ScSingleRefData( rTr.Ref2 ) );
519  else
522 
523  nElementCurrent++;
524 
525  return static_cast<const TokenId>(nElementCurrent); // return old value + 1!
526 }
527 
528 TokenId TokenPool::Store( const DefTokenId e, const OUString& r )
529 {
530  if (!CheckElementOrGrow())
531  return static_cast<const TokenId>(nElementCurrent+1);
532 
533  if( ppP_Ext.m_writemark >= ppP_Ext.m_capacity )
534  if (!ppP_Ext.Grow())
535  return static_cast<const TokenId>(nElementCurrent+1);
536 
537  pElement[ nElementCurrent ] = ppP_Ext.m_writemark;
538  pType[ nElementCurrent ] = T_Ext; // set Typeinfo String
539 
540  if( ppP_Ext[ ppP_Ext.m_writemark ] )
541  {
542  ppP_Ext[ ppP_Ext.m_writemark ]->eId = e;
543  ppP_Ext[ ppP_Ext.m_writemark ]->aText = r;
544  }
545  else
546  ppP_Ext[ ppP_Ext.m_writemark ].reset( new EXTCONT( e, r ) );
547 
548  nElementCurrent++;
549  ppP_Ext.m_writemark++;
550 
551  return static_cast<const TokenId>(nElementCurrent); // return old value + 1!
552 }
553 
555 {
556  if (!CheckElementOrGrow())
557  return static_cast<const TokenId>(nElementCurrent+1);
558 
560  if (!ppP_Nlf.Grow())
561  return static_cast<const TokenId>(nElementCurrent+1);
562 
565 
566  if( ppP_Nlf[ ppP_Nlf.m_writemark ] )
567  {
568  *ppP_Nlf[ ppP_Nlf.m_writemark ] = rTr;
569  }
570  else
571  ppP_Nlf[ ppP_Nlf.m_writemark ].reset( new ScSingleRefData( rTr ) );
572 
573  nElementCurrent++;
575 
576  return static_cast<const TokenId>(nElementCurrent);
577 }
578 
580 {
581  if (!CheckElementOrGrow())
582  return static_cast<const TokenId>(nElementCurrent+1);
583 
584  if( nP_MatrixCurrent >= nP_Matrix )
585  if (!GrowMatrix())
586  return static_cast<const TokenId>(nElementCurrent+1);
587 
590 
591  ScMatrix* pM = new ScMatrix( 0, 0 );
592  pM->IncRef( );
594 
595  nElementCurrent++;
597 
598  return static_cast<const TokenId>(nElementCurrent);
599 }
600 
601 TokenId TokenPool::StoreName( sal_uInt16 nIndex, sal_Int16 nSheet )
602 {
603  if (!CheckElementOrGrow())
604  return static_cast<const TokenId>(nElementCurrent+1);
605 
606  pElement[nElementCurrent] = static_cast<sal_uInt16>(maRangeNames.size());
608 
609  maRangeNames.emplace_back();
610  RangeName& r = maRangeNames.back();
611  r.mnIndex = nIndex;
612  r.mnSheet = nSheet;
613 
614  ++nElementCurrent;
615 
616  return static_cast<const TokenId>(nElementCurrent);
617 }
618 
619 TokenId TokenPool::StoreExtName( sal_uInt16 nFileId, const OUString& rName )
620 {
621  if (!CheckElementOrGrow())
622  return static_cast<const TokenId>(nElementCurrent+1);
623 
624  pElement[nElementCurrent] = static_cast<sal_uInt16>(maExtNames.size());
626 
627  maExtNames.emplace_back();
628  ExtName& r = maExtNames.back();
629  r.mnFileId = nFileId;
630  r.maName = rName;
631 
632  ++nElementCurrent;
633 
634  return static_cast<const TokenId>(nElementCurrent);
635 }
636 
637 TokenId TokenPool::StoreExtRef( sal_uInt16 nFileId, const OUString& rTabName, const ScSingleRefData& rRef )
638 {
639  if (!CheckElementOrGrow())
640  return static_cast<const TokenId>(nElementCurrent+1);
641 
642  pElement[nElementCurrent] = static_cast<sal_uInt16>(maExtCellRefs.size());
644 
645  maExtCellRefs.emplace_back();
646  ExtCellRef& r = maExtCellRefs.back();
647  r.mnFileId = nFileId;
648  r.maTabName = rTabName;
649  r.maRef = rRef;
650 
651  ++nElementCurrent;
652 
653  return static_cast<const TokenId>(nElementCurrent);
654 }
655 
656 TokenId TokenPool::StoreExtRef( sal_uInt16 nFileId, const OUString& rTabName, const ScComplexRefData& rRef )
657 {
658  if (!CheckElementOrGrow())
659  return static_cast<const TokenId>(nElementCurrent+1);
660 
661  pElement[nElementCurrent] = static_cast<sal_uInt16>(maExtAreaRefs.size());
663 
664  maExtAreaRefs.emplace_back();
665  ExtAreaRef& r = maExtAreaRefs.back();
666  r.mnFileId = nFileId;
667  r.maTabName = rTabName;
668  r.maRef = rRef;
669 
670  ++nElementCurrent;
671 
672  return static_cast<const TokenId>(nElementCurrent);
673 }
674 
676 {
680  maRangeNames.clear();
681  maExtNames.clear();
682  maExtCellRefs.clear();
683  maExtAreaRefs.clear();
684  ClearMatrix();
685 }
686 
687 bool TokenPool::IsSingleOp( const TokenId& rId, const DefTokenId eId ) const
688 {
689  sal_uInt16 nId = static_cast<sal_uInt16>(rId);
690  if( nId && nId <= nElementCurrent )
691  {// existent?
692  nId--;
693  if( T_Id == pType[ nId ] )
694  {// Token-Sequence?
695  if( pSize[ nId ] == 1 )
696  {// EXACTLY 1 Token
697  sal_uInt16 nPid = pElement[ nId ];
698  if (nPid < nP_Id)
699  {
700  sal_uInt16 nSecId = pP_Id[ nPid ];
701  if( nSecId >= nScTokenOff )
702  {// Default-Token?
703  return static_cast<DefTokenId>( nSecId - nScTokenOff ) == eId; // wanted?
704  }
705  }
706  }
707  }
708  }
709 
710  return false;
711 }
712 
713 const OUString* TokenPool::GetExternal( const TokenId& rId ) const
714 {
715  const OUString* p = nullptr;
716  sal_uInt16 n = static_cast<sal_uInt16>(rId);
717  if( n && n <= nElementCurrent )
718  {
719  n--;
720  if( pType[ n ] == T_Ext )
721  {
722  sal_uInt16 nExt = pElement[ n ];
723  if ( nExt < ppP_Ext.m_writemark && ppP_Ext[ nExt ] )
724  p = &ppP_Ext[ nExt ]->aText;
725  }
726  }
727 
728  return p;
729 }
730 
731 ScMatrix* TokenPool::GetMatrix( unsigned int n ) const
732 {
733  if( n < nP_MatrixCurrent )
734  return ppP_Matrix[ n ];
735  else
736  SAL_WARN("sc.filter", "GetMatrix: " << n << " >= " << nP_MatrixCurrent);
737  return nullptr;
738 }
739 
741 {
742  for(sal_uInt16 n = 0 ; n < nP_Matrix ; n++ )
743  {
744  if( ppP_Matrix[ n ] )
745  {
746  ppP_Matrix[ n ]->DecRef( );
747  ppP_Matrix[n] = nullptr;
748  }
749  }
750 }
751 
752 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 nP_Id
Definition: tokstack.hxx:147
Matrix data type that can store values of mixed types.
Definition: scmatrix.hxx:113
TokenPoolPool< std::unique_ptr< OUString >, 4 > ppP_Str
Definition: tokstack.hxx:137
formula::FormulaToken * AddDoubleReference(const ScComplexRefData &rRef)
Definition: token.cxx:2212
svl::SharedStringPool & mrStringPool
Definition: tokstack.hxx:134
ScComplexRefData maRef
Definition: tokstack.hxx:198
formula::FormulaToken * AddExternalDoubleReference(sal_uInt16 nFileId, const svl::SharedString &rTabName, const ScComplexRefData &rRef)
Definition: token.cxx:2243
E_TYPE
Definition: tokstack.hxx:54
std::unique_ptr< sal_uInt16[]> pElement
Definition: tokstack.hxx:202
std::unique_ptr< sal_uInt16[]> pP_Id
Definition: tokstack.hxx:146
bool GetElementRek(const sal_uInt16 nId, ScTokenArray *pScToken)
Definition: tokstack.cxx:332
SharedString intern(const OUString &rStr)
Single reference (one address) into the sheet.
Definition: refdata.hxx:30
TokenPoolPool< std::unique_ptr< EXTCONT >, 32 > ppP_Ext
Definition: tokstack.hxx:159
sal_uInt16 m_capacity
Definition: tokstack.hxx:75
std::unique_ptr< ScMatrix *[]> ppP_Matrix
Definition: tokstack.hxx:164
sal_uInt16 nP_MatrixCurrent
Definition: tokstack.hxx:166
TokenId StoreExtName(sal_uInt16 nFileId, const OUString &rName)
Definition: tokstack.cxx:619
formula::FormulaToken * AddExternalName(sal_uInt16 nFileId, const svl::SharedString &rName)
Definition: token.cxx:2232
TokenPoolPool< std::unique_ptr< ScSingleRefData >, 16 > ppP_Nlf
Definition: tokstack.hxx:162
sal_Int64 n
formula::FormulaToken * AddSingleReference(const ScSingleRefData &rRef)
ScSingleRefToken with ocPush.
Definition: token.cxx:2202
sal_Int16 nId
std::unique_ptr< E_TYPE[]> pType
Definition: tokstack.hxx:203
sal_uInt16 m_writemark
Definition: tokstack.hxx:76
for storage of external area references
Definition: tokstack.hxx:194
const OUString * GetExternal(const TokenId &rId) const
Definition: tokstack.cxx:713
bool GrowId()
Definition: tokstack.cxx:88
bool GetElement(const sal_uInt16 nId, ScTokenArray *pScToken)
Definition: tokstack.cxx:170
TokenPool(svl::SharedStringPool &rSPool)
Definition: tokstack.cxx:46
TokenId Store()
Definition: tokstack.hxx:404
#define SAL_MAX_UINT16
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
OpCode
void ClearMatrix()
Definition: tokstack.cxx:740
TokenId StoreNlf(const ScSingleRefData &rTr)
Definition: tokstack.cxx:554
sal_uInt16 nElementCurrent
Definition: tokstack.hxx:206
::std::vector< RangeName > maRangeNames
Definition: tokstack.hxx:174
sal_uInt16 nP_IdCurrent
Definition: tokstack.hxx:148
static sal_uInt16 lcl_canGrow(sal_uInt16 nOld)
Returns the new number of elements, or 0 if overflow.
Definition: tokstack.cxx:73
void AddRangeName(sal_uInt16 n, sal_Int16 nSheet)
Definition: token.cxx:2222
void Reset()
Definition: tokstack.hxx:328
for storage of named ranges
Definition: tokstack.hxx:169
static const sal_uInt16 nScTokenOff
Definition: tokstack.hxx:208
sal_uInt16 nP_IdLast
Definition: tokstack.hxx:149
ScSingleRefData Ref1
Definition: refdata.hxx:125
Definition: tokstack.hxx:58
ScSingleRefData Ref2
Definition: refdata.hxx:126
bool IsSingleOp(const TokenId &rId, const DefTokenId eId) const
Definition: tokstack.cxx:687
sal_uInt16 mnIndex
Definition: tokstack.hxx:171
formula::FormulaToken * AddMatrix(const ScMatrixRef &p)
Definition: token.cxx:2217
ScMatrix * GetMatrix(unsigned int n) const
Definition: tokstack.cxx:731
TokenId StoreMatrix()
Definition: tokstack.cxx:579
bool GrowElement()
Definition: tokstack.cxx:122
TokenId StoreName(sal_uInt16 nIndex, sal_Int16 nSheet)
Definition: tokstack.cxx:601
T * getIfInRange(sal_uInt16 n) const
Definition: tokstack.hxx:115
formula::FormulaToken * AddColRowName(const ScSingleRefData &rRef)
ScSingleRefOpToken with ocColRowName.
Definition: token.cxx:2249
for storage of external cell references
Definition: tokstack.hxx:185
sal_uInt16 nElement
Definition: tokstack.hxx:205
virtual formula::FormulaToken * AddOpCode(OpCode eCode) override
Definition: token.cxx:2195
::std::vector< ExtCellRef > maExtCellRefs
Definition: tokstack.hxx:191
bool GrowMatrix()
Definition: tokstack.cxx:151
sal_uInt16 m_nRek
Definition: tokstack.hxx:210
void IncRef() const
Definition: scmatrix.cxx:2844
TokenPoolPool< sal_uInt16, 8 > pP_Err
Definition: tokstack.hxx:142
FormulaToken * AddString(const svl::SharedString &rStr)
ocEuroConvert
bool Grow(sal_uInt16 nByMin=1)
Definition: tokstack.hxx:84
::std::vector< ExtAreaRef > maExtAreaRefs
Definition: tokstack.hxx:200
std::unique_ptr< sal_uInt16[]> pSize
Definition: tokstack.hxx:204
void AddExternalSingleReference(sal_uInt16 nFileId, const svl::SharedString &rTabName, const ScSingleRefData &rRef)
Definition: token.cxx:2237
void * p
TokenId StoreExtRef(sal_uInt16 nFileId, const OUString &rTabName, const ScSingleRefData &rRef)
Definition: tokstack.cxx:637
void AddExternal(const sal_Unicode *pStr)
Complex reference (a range) into the sheet.
Definition: refdata.hxx:123
::std::vector< ExtName > maExtNames
Definition: tokstack.hxx:182
sal_uInt16 nP_Matrix
Definition: tokstack.hxx:165
for storage of external names
Definition: tokstack.hxx:177
#define SAL_WARN(area, stream)
bool CheckElementOrGrow()
Definition: tokstack.cxx:107
sal_uInt16 mnFileId
Definition: tokstack.hxx:179
void Reset()
Definition: tokstack.cxx:675
~TokenPool()
Definition: tokstack.cxx:67
TokenPoolPool< std::unique_ptr< ScSingleRefData >, 32 > ppP_RefTr
Definition: tokstack.hxx:145
void operator>>(TokenId &rId)
Definition: tokstack.cxx:403
ScSingleRefData maRef
Definition: tokstack.hxx:189
FormulaToken * AddDouble(double fVal)
TokenPoolPool< double, 8 > pP_Dbl
Definition: tokstack.hxx:139