1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include "compiler.hxx"
23 #include "tokstack.hxx"
25 #include "scmatrix.hxx"
27 #include <stdio.h> // printf
29 const sal_uInt16
TokenPool::nScTokenOff
= 8192;
32 TokenStack::TokenStack( sal_uInt16 nNewSize
)
34 pStack
= new TokenId
[ nNewSize
];
41 TokenStack::~TokenStack()
49 //------------------------------------------------------------------------
51 // !ACHTUNG!: nach Aussen hin beginnt die Nummerierung mit 1!
52 // !ACHTUNG!: SC-Token werden mit einem Offset nScTokenOff abgelegt
53 // -> Unterscheidung von anderen Token
56 TokenPool::TokenPool( void )
58 sal_uInt16 nLauf
= nScTokenOff
;
60 // Sammelstelle fuer Id-Folgen
62 pP_Id
= new sal_uInt16
[ nP_Id
];
64 // Sammelstelle fuer Ids
66 pElement
= new sal_uInt16
[ nElement
];
67 pType
= new E_TYPE
[ nElement
];
68 pSize
= new sal_uInt16
[ nElement
];
71 // Sammelstelle fuer Strings
73 ppP_Str
= new String
*[ nP_Str
];
74 for( nLauf
= 0 ; nLauf
< nP_Str
; nLauf
++ )
75 ppP_Str
[ nLauf
] = NULL
;
77 // Sammelstelle fuer double
79 pP_Dbl
= new double[ nP_Dbl
];
81 // Sammelstelle fuer error codes
83 pP_Err
= new sal_uInt16
[ nP_Err
];
85 // Sammelstellen fuer Referenzen
87 ppP_RefTr
= new ScSingleRefData
*[ nP_RefTr
];
88 for( nLauf
= 0 ; nLauf
< nP_RefTr
; nLauf
++ )
89 ppP_RefTr
[ nLauf
] = NULL
;
92 ppP_Ext
= new EXTCONT
*[ nP_Ext
];
93 memset( ppP_Ext
, 0, sizeof( EXTCONT
* ) * nP_Ext
);
96 ppP_Nlf
= new NLFCONT
*[ nP_Nlf
];
97 memset( ppP_Nlf
, 0, sizeof( NLFCONT
* ) * nP_Nlf
);
100 ppP_Matrix
= new ScMatrix
*[ nP_Matrix
];
101 memset( ppP_Matrix
, 0, sizeof( ScMatrix
* ) * nP_Matrix
);
103 pScToken
= new ScTokenArray
;
109 TokenPool::~TokenPool()
120 for( n
= 0 ; n
< nP_RefTr
; n
++ )
121 delete ppP_RefTr
[ n
];
124 for( n
= 0 ; n
< nP_Str
; n
++ )
128 for( n
= 0 ; n
< nP_Ext
; n
++ )
132 for( n
= 0 ; n
< nP_Nlf
; n
++ )
136 for( n
= 0 ; n
< nP_Matrix
; n
++ )
138 if( ppP_Matrix
[ n
] )
139 ppP_Matrix
[ n
]->DecRef( );
147 /** Returns the new number of elements, or 0 if overflow. */
148 static sal_uInt16
lcl_canGrow( sal_uInt16 nOld
, sal_uInt16 nByMin
= 1 )
151 return nByMin
? nByMin
: 1;
152 if (nOld
== SAL_MAX_UINT16
)
154 sal_uInt32 nNew
= ::std::max( static_cast<sal_uInt32
>(nOld
) * 2,
155 static_cast<sal_uInt32
>(nOld
) + nByMin
);
156 if (nNew
> SAL_MAX_UINT16
)
157 nNew
= SAL_MAX_UINT16
;
158 if (nNew
- nByMin
< nOld
)
160 return static_cast<sal_uInt16
>(nNew
);
164 bool TokenPool::GrowString( void )
166 sal_uInt16 nP_StrNew
= lcl_canGrow( nP_Str
);
172 String
** ppP_StrNew
= new (::std::nothrow
) String
*[ nP_StrNew
];
176 for( nL
= 0 ; nL
< nP_Str
; nL
++ )
177 ppP_StrNew
[ nL
] = ppP_Str
[ nL
];
178 for( nL
= nP_Str
; nL
< nP_StrNew
; nL
++ )
179 ppP_StrNew
[ nL
] = NULL
;
184 ppP_Str
= ppP_StrNew
;
189 bool TokenPool::GrowDouble( void )
191 sal_uInt16 nP_DblNew
= lcl_canGrow( nP_Dbl
);
196 double* pP_DblNew
= new (::std::nothrow
) double[ nP_DblNew
];
200 for( sal_uInt16 nL
= 0 ; nL
< nP_Dbl
; nL
++ )
201 pP_DblNew
[ nL
] = pP_Dbl
[ nL
];
211 /* TODO: in case we had FormulaTokenArray::AddError() */
213 void TokenPool::GrowError( void )
215 sal_uInt16 nP_ErrNew
= lcl_canGrow( nP_Err
);
220 sal_uInt16
* pP_ErrNew
= new (::std::nothrow
) sal_uInt16
[ nP_ErrNew
];
224 for( sal_uInt16 nL
= 0 ; nL
< nP_Err
; nL
++ )
225 pP_ErrNew
[ nL
] = pP_Err
[ nL
];
236 bool TokenPool::GrowTripel( sal_uInt16 nByMin
)
238 sal_uInt16 nP_RefTrNew
= lcl_canGrow( nP_RefTr
, nByMin
);
244 ScSingleRefData
** ppP_RefTrNew
= new (::std::nothrow
) ScSingleRefData
*[ nP_RefTrNew
];
248 for( nL
= 0 ; nL
< nP_RefTr
; nL
++ )
249 ppP_RefTrNew
[ nL
] = ppP_RefTr
[ nL
];
250 for( nL
= nP_RefTr
; nL
< nP_RefTrNew
; nL
++ )
251 ppP_RefTrNew
[ nL
] = NULL
;
253 nP_RefTr
= nP_RefTrNew
;
256 ppP_RefTr
= ppP_RefTrNew
;
261 bool TokenPool::GrowId( void )
263 sal_uInt16 nP_IdNew
= lcl_canGrow( nP_Id
);
268 sal_uInt16
* pP_IdNew
= new (::std::nothrow
) sal_uInt16
[ nP_IdNew
];
272 for( sal_uInt16 nL
= 0 ; nL
< nP_Id
; nL
++ )
273 pP_IdNew
[ nL
] = pP_Id
[ nL
];
283 bool TokenPool::GrowElement( void )
285 sal_uInt16 nElementNew
= lcl_canGrow( nElement
);
290 sal_uInt16
* pElementNew
= new (::std::nothrow
) sal_uInt16
[ nElementNew
];
291 E_TYPE
* pTypeNew
= new (::std::nothrow
) E_TYPE
[ nElementNew
];
292 sal_uInt16
* pSizeNew
= new (::std::nothrow
) sal_uInt16
[ nElementNew
];
293 if (!pElementNew
|| !pTypeNew
|| !pSizeNew
)
295 delete [] pElementNew
;
301 for( sal_uInt16 nL
= 0 ; nL
< nElement
; nL
++ )
303 pElementNew
[ nL
] = pElement
[ nL
];
304 pTypeNew
[ nL
] = pType
[ nL
];
305 pSizeNew
[ nL
] = pSize
[ nL
];
308 nElement
= nElementNew
;
313 pElement
= pElementNew
;
320 bool TokenPool::GrowExt( void )
322 sal_uInt16 nNewSize
= lcl_canGrow( nP_Ext
);
326 EXTCONT
** ppNew
= new (::std::nothrow
) EXTCONT
*[ nNewSize
];
330 memset( ppNew
, 0, sizeof( EXTCONT
* ) * nNewSize
);
331 memcpy( ppNew
, ppP_Ext
, sizeof( EXTCONT
* ) * nP_Ext
);
340 bool TokenPool::GrowNlf( void )
342 sal_uInt16 nNewSize
= lcl_canGrow( nP_Nlf
);
346 NLFCONT
** ppNew
= new (::std::nothrow
) NLFCONT
*[ nNewSize
];
350 memset( ppNew
, 0, sizeof( NLFCONT
* ) * nNewSize
);
351 memcpy( ppNew
, ppP_Nlf
, sizeof( NLFCONT
* ) * nP_Nlf
);
360 bool TokenPool::GrowMatrix( void )
362 sal_uInt16 nNewSize
= lcl_canGrow( nP_Matrix
);
366 ScMatrix
** ppNew
= new (::std::nothrow
) ScMatrix
*[ nNewSize
];
370 memset( ppNew
, 0, sizeof( ScMatrix
* ) * nNewSize
);
371 memcpy( ppNew
, ppP_Matrix
, sizeof( ScMatrix
* ) * nP_Matrix
);
375 nP_Matrix
= nNewSize
;
379 bool TokenPool::GetElement( const sal_uInt16 nId
)
381 OSL_ENSURE( nId
< nElementAkt
, "*TokenPool::GetElement(): Id too large!?" );
382 if (nId
>= nElementAkt
)
386 if( pType
[ nId
] == T_Id
)
387 bRet
= GetElementRek( nId
);
390 switch( pType
[ nId
] )
394 sal_uInt16 n
= pElement
[ nId
];
395 String
* p
= ( n
< nP_Str
)? ppP_Str
[ n
] : NULL
;
397 pScToken
->AddString( *p
);
404 sal_uInt16 n
= pElement
[ nId
];
406 pScToken
->AddDouble( pP_Dbl
[ n
] );
412 /* TODO: in case we had FormulaTokenArray::AddError() */
415 sal_uInt16 n
= pElement
[ nId
];
417 pScToken
->AddError( pP_Err
[ n
] );
425 sal_uInt16 n
= pElement
[ nId
];
426 ScSingleRefData
* p
= ( n
< nP_RefTr
)? ppP_RefTr
[ n
] : NULL
;
428 pScToken
->AddSingleReference( *p
);
435 sal_uInt16 n
= pElement
[ nId
];
436 if (n
< nP_RefTr
&& ppP_RefTr
[ n
] && n
+1 < nP_RefTr
&& ppP_RefTr
[ n
+ 1 ])
438 ScComplexRefData aScComplexRefData
;
439 aScComplexRefData
.Ref1
= *ppP_RefTr
[ n
];
440 aScComplexRefData
.Ref2
= *ppP_RefTr
[ n
+ 1 ];
441 pScToken
->AddDoubleReference( aScComplexRefData
);
449 sal_uInt16 n
= pElement
[nId
];
450 if (n
< maRangeNames
.size())
452 const RangeName
& r
= maRangeNames
[n
];
453 pScToken
->AddRangeName(r
.mnIndex
, r
.mbGlobal
);
459 sal_uInt16 n
= pElement
[ nId
];
460 EXTCONT
* p
= ( n
< nP_Ext
)? ppP_Ext
[ n
] : NULL
;
464 if( p
->eId
== ocEuroConvert
)
465 pScToken
->AddOpCode( p
->eId
);
467 pScToken
->AddExternal( p
->aText
, p
->eId
);
475 sal_uInt16 n
= pElement
[ nId
];
476 NLFCONT
* p
= ( n
< nP_Nlf
)? ppP_Nlf
[ n
] : NULL
;
479 pScToken
->AddColRowName( p
->aRef
);
486 sal_uInt16 n
= pElement
[ nId
];
487 ScMatrix
* p
= ( n
< nP_Matrix
)? ppP_Matrix
[ n
] : NULL
;
490 pScToken
->AddMatrix( p
);
497 sal_uInt16 n
= pElement
[nId
];
498 if (n
< maExtNames
.size())
500 const ExtName
& r
= maExtNames
[n
];
501 pScToken
->AddExternalName(r
.mnFileId
, r
.maName
);
509 sal_uInt16 n
= pElement
[nId
];
510 if (n
< maExtCellRefs
.size())
512 const ExtCellRef
& r
= maExtCellRefs
[n
];
513 pScToken
->AddExternalSingleReference(r
.mnFileId
, r
.maTabName
, r
.maRef
);
521 sal_uInt16 n
= pElement
[nId
];
522 if (n
< maExtAreaRefs
.size())
524 const ExtAreaRef
& r
= maExtAreaRefs
[n
];
525 pScToken
->AddExternalDoubleReference(r
.mnFileId
, r
.maTabName
, r
.maRef
);
532 OSL_FAIL("-TokenPool::GetElement(): undefined state!?");
540 bool TokenPool::GetElementRek( const sal_uInt16 nId
)
544 OSL_ENSURE(m_nRek
<= nP_Id
, "*TokenPool::GetElement(): recursion loops!?");
547 OSL_ENSURE( nId
< nElementAkt
, "*TokenPool::GetElementRek(): nId >= nElementAkt" );
549 if (nId
>= nElementAkt
)
551 DBG_ERRORFILE( "*TokenPool::GetElementRek(): nId >= nElementAkt" );
558 if (pType
[ nId
] != T_Id
)
560 DBG_ERRORFILE( "-TokenPool::GetElementRek(): pType[ nId ] != T_Id" );
569 sal_uInt16 nAnz
= pSize
[ nId
];
570 sal_uInt16 nFirstId
= pElement
[ nId
];
571 if (nFirstId
>= nP_Id
)
573 DBG_ERRORFILE( "TokenPool::GetElementRek: nFirstId >= nP_Id");
577 sal_uInt16
* pAkt
= nAnz
? &pP_Id
[ nFirstId
] : NULL
;
578 if (nAnz
> nP_Id
- nFirstId
)
580 DBG_ERRORFILE( "TokenPool::GetElementRek: nAnz > nP_Id - nFirstId");
581 nAnz
= nP_Id
- nFirstId
;
584 for( ; nAnz
> 0 ; nAnz
--, pAkt
++ )
586 if( *pAkt
< nScTokenOff
)
587 {// Rekursion oder nicht?
588 if (*pAkt
>= nElementAkt
)
590 DBG_ERRORFILE( "TokenPool::GetElementRek: *pAkt >= nElementAkt");
595 if (pType
[ *pAkt
] == T_Id
)
596 bRet
= GetElementRek( *pAkt
);
598 bRet
= GetElement( *pAkt
);
601 else // elementarer SC_Token
602 pScToken
->AddOpCode( ( DefTokenId
) ( *pAkt
- nScTokenOff
) );
613 void TokenPool::operator >>( TokenId
& rId
)
615 rId
= ( TokenId
) ( nElementAkt
+ 1 );
617 if( nElementAkt
>= nElement
)
621 pElement
[ nElementAkt
] = nP_IdLast
; // Start der Token-Folge
622 pType
[ nElementAkt
] = T_Id
; // Typinfo eintragen
623 pSize
[ nElementAkt
] = nP_IdAkt
- nP_IdLast
;
624 // von nP_IdLast bis nP_IdAkt-1 geschrieben -> Laenge der Folge
626 nElementAkt
++; // Startwerte fuer naechste Folge
627 nP_IdLast
= nP_IdAkt
;
631 const TokenId
TokenPool::Store( const double& rDouble
)
633 if( nElementAkt
>= nElement
)
635 return (const TokenId
) nElementAkt
+1;
637 if( nP_DblAkt
>= nP_Dbl
)
639 return (const TokenId
) nElementAkt
+1;
641 pElement
[ nElementAkt
] = nP_DblAkt
; // Index in Double-Array
642 pType
[ nElementAkt
] = T_D
; // Typinfo Double eintragen
644 pP_Dbl
[ nP_DblAkt
] = rDouble
;
646 pSize
[ nElementAkt
] = 1; // eigentlich Banane
651 return ( const TokenId
) nElementAkt
; // Ausgabe von altem Wert + 1!
655 const TokenId
TokenPool::Store( const sal_uInt16 nIndex
)
657 return StoreName(nIndex
, true);
661 const TokenId
TokenPool::Store( const String
& rString
)
663 // weitgehend nach Store( const sal_Char* ) kopiert, zur Vermeidung
664 // eines temporaeren Strings in "
665 if( nElementAkt
>= nElement
)
667 return (const TokenId
) nElementAkt
+1;
670 if( nP_StrAkt
>= nP_Str
)
672 return (const TokenId
) nElementAkt
+1;
675 pElement
[ nElementAkt
] = nP_StrAkt
; // Index in String-Array
676 pType
[ nElementAkt
] = T_Str
; // Typinfo String eintragen
679 if( !ppP_Str
[ nP_StrAkt
] )
680 //...aber nur, wenn noch nicht vorhanden
681 ppP_Str
[ nP_StrAkt
] = new (::std::nothrow
) String( rString
);
683 //...ansonsten nur kopieren
684 *ppP_Str
[ nP_StrAkt
] = rString
;
686 if (ppP_Str
[ nP_StrAkt
])
688 DBG_ASSERT( sizeof( xub_StrLen
) <= 2, "*TokenPool::Store(): StrLen doesn't match!" );
689 pSize
[ nElementAkt
] = ( sal_uInt16
) ppP_Str
[ nP_StrAkt
]->Len();
695 return ( const TokenId
) nElementAkt
; // Ausgabe von altem Wert + 1!
699 const TokenId
TokenPool::Store( const ScSingleRefData
& rTr
)
701 if( nElementAkt
>= nElement
)
703 return (const TokenId
) nElementAkt
+1;
705 if( nP_RefTrAkt
>= nP_RefTr
)
707 return (const TokenId
) nElementAkt
+1;
709 pElement
[ nElementAkt
] = nP_RefTrAkt
;
710 pType
[ nElementAkt
] = T_RefC
; // Typinfo Cell-Reff eintragen
712 if( !ppP_RefTr
[ nP_RefTrAkt
] )
713 ppP_RefTr
[ nP_RefTrAkt
] = new ScSingleRefData( rTr
);
715 *ppP_RefTr
[ nP_RefTrAkt
] = rTr
;
720 return ( const TokenId
) nElementAkt
; // Ausgabe von altem Wert + 1!
724 const TokenId
TokenPool::Store( const ScComplexRefData
& rTr
)
726 if( nElementAkt
>= nElement
)
728 return (const TokenId
) nElementAkt
+1;
730 if( nP_RefTrAkt
+ 1 >= nP_RefTr
)
732 return (const TokenId
) nElementAkt
+1;
734 pElement
[ nElementAkt
] = nP_RefTrAkt
;
735 pType
[ nElementAkt
] = T_RefA
; // Typinfo Area-Reff eintragen
737 if( !ppP_RefTr
[ nP_RefTrAkt
] )
738 ppP_RefTr
[ nP_RefTrAkt
] = new ScSingleRefData( rTr
.Ref1
);
740 *ppP_RefTr
[ nP_RefTrAkt
] = rTr
.Ref1
;
743 if( !ppP_RefTr
[ nP_RefTrAkt
] )
744 ppP_RefTr
[ nP_RefTrAkt
] = new ScSingleRefData( rTr
.Ref2
);
746 *ppP_RefTr
[ nP_RefTrAkt
] = rTr
.Ref2
;
751 return ( const TokenId
) nElementAkt
; // Ausgabe von altem Wert + 1!
755 const TokenId
TokenPool::Store( const DefTokenId e
, const String
& r
)
757 if( nElementAkt
>= nElement
)
759 return (const TokenId
) nElementAkt
+1;
761 if( nP_ExtAkt
>= nP_Ext
)
763 return (const TokenId
) nElementAkt
+1;
765 pElement
[ nElementAkt
] = nP_ExtAkt
;
766 pType
[ nElementAkt
] = T_Ext
; // Typinfo String eintragen
768 if( ppP_Ext
[ nP_ExtAkt
] )
770 ppP_Ext
[ nP_ExtAkt
]->eId
= e
;
771 ppP_Ext
[ nP_ExtAkt
]->aText
= r
;
774 ppP_Ext
[ nP_ExtAkt
] = new EXTCONT( e
, r
);
779 return ( const TokenId
) nElementAkt
; // Ausgabe von altem Wert + 1!
783 const TokenId
TokenPool::StoreNlf( const ScSingleRefData
& rTr
)
785 if( nElementAkt
>= nElement
)
787 return (const TokenId
) nElementAkt
+1;
789 if( nP_NlfAkt
>= nP_Nlf
)
791 return (const TokenId
) nElementAkt
+1;
793 pElement
[ nElementAkt
] = nP_NlfAkt
;
794 pType
[ nElementAkt
] = T_Nlf
;
796 if( ppP_Nlf
[ nP_NlfAkt
] )
798 ppP_Nlf
[ nP_NlfAkt
]->aRef
= rTr
;
801 ppP_Nlf
[ nP_NlfAkt
] = new NLFCONT( rTr
);
806 return ( const TokenId
) nElementAkt
;
809 const TokenId
TokenPool::StoreMatrix()
813 if( nElementAkt
>= nElement
)
815 return (const TokenId
) nElementAkt
+1;
817 if( nP_MatrixAkt
>= nP_Matrix
)
819 return (const TokenId
) nElementAkt
+1;
821 pElement
[ nElementAkt
] = nP_MatrixAkt
;
822 pType
[ nElementAkt
] = T_Matrix
;
824 pM
= new ScMatrix( 0, 0 );
826 ppP_Matrix
[ nP_MatrixAkt
] = pM
;
831 return ( const TokenId
) nElementAkt
;
834 const TokenId
TokenPool::StoreName( sal_uInt16 nIndex
, bool bGlobal
)
836 if ( nElementAkt
>= nElement
)
838 return (const TokenId
) nElementAkt
+1;
840 pElement
[nElementAkt
] = static_cast<sal_uInt16
>(maRangeNames
.size());
841 pType
[nElementAkt
] = T_RN
;
843 maRangeNames
.push_back(RangeName());
844 RangeName
& r
= maRangeNames
.back();
846 r
.mbGlobal
= bGlobal
;
850 return static_cast<const TokenId
>(nElementAkt
);
853 const TokenId
TokenPool::StoreExtName( sal_uInt16 nFileId
, const String
& rName
)
855 if ( nElementAkt
>= nElement
)
857 return (const TokenId
) nElementAkt
+1;
859 pElement
[nElementAkt
] = static_cast<sal_uInt16
>(maExtNames
.size());
860 pType
[nElementAkt
] = T_ExtName
;
862 maExtNames
.push_back(ExtName());
863 ExtName
& r
= maExtNames
.back();
864 r
.mnFileId
= nFileId
;
869 return static_cast<const TokenId
>(nElementAkt
);
872 const TokenId
TokenPool::StoreExtRef( sal_uInt16 nFileId
, const String
& rTabName
, const ScSingleRefData
& rRef
)
874 if ( nElementAkt
>= nElement
)
876 return (const TokenId
) nElementAkt
+1;
878 pElement
[nElementAkt
] = static_cast<sal_uInt16
>(maExtCellRefs
.size());
879 pType
[nElementAkt
] = T_ExtRefC
;
881 maExtCellRefs
.push_back(ExtCellRef());
882 ExtCellRef
& r
= maExtCellRefs
.back();
883 r
.mnFileId
= nFileId
;
884 r
.maTabName
= rTabName
;
889 return static_cast<const TokenId
>(nElementAkt
);
892 const TokenId
TokenPool::StoreExtRef( sal_uInt16 nFileId
, const String
& rTabName
, const ScComplexRefData
& rRef
)
894 if ( nElementAkt
>= nElement
)
896 return (const TokenId
) nElementAkt
+1;
898 pElement
[nElementAkt
] = static_cast<sal_uInt16
>(maExtAreaRefs
.size());
899 pType
[nElementAkt
] = T_ExtRefA
;
901 maExtAreaRefs
.push_back(ExtAreaRef());
902 ExtAreaRef
& r
= maExtAreaRefs
.back();
903 r
.mnFileId
= nFileId
;
904 r
.maTabName
= rTabName
;
909 return static_cast<const TokenId
>(nElementAkt
);
912 void TokenPool::Reset( void )
914 nP_IdAkt
= nP_IdLast
= nElementAkt
= nP_StrAkt
= nP_DblAkt
= nP_ErrAkt
= nP_RefTrAkt
= nP_ExtAkt
= nP_NlfAkt
= nP_MatrixAkt
= 0;
915 maRangeNames
.clear();
917 maExtCellRefs
.clear();
918 maExtAreaRefs
.clear();
922 sal_Bool
TokenPool::IsSingleOp( const TokenId
& rId
, const DefTokenId eId
) const
924 sal_uInt16 nId
= (sal_uInt16
) rId
;
925 if( nId
&& nId
<= nElementAkt
)
928 if( T_Id
== pType
[ nId
] )
930 if( pSize
[ nId
] == 1 )
932 sal_uInt16 nPid
= pElement
[ nId
];
935 sal_uInt16 nSecId
= pP_Id
[ nPid
];
936 if( nSecId
>= nScTokenOff
)
938 return ( DefTokenId
) ( nSecId
- nScTokenOff
) == eId
; // Gesuchter?
948 const String
* TokenPool::GetExternal( const TokenId
& rId
) const
950 const String
* p
= NULL
;
951 sal_uInt16 n
= (sal_uInt16
) rId
;
952 if( n
&& n
<= nElementAkt
)
955 if( pType
[ n
] == T_Ext
)
957 sal_uInt16 nExt
= pElement
[ n
];
958 if ( nExt
< nP_Ext
&& ppP_Ext
[ nExt
] )
959 p
= &ppP_Ext
[ nExt
]->aText
;
966 ScMatrix
* TokenPool::GetMatrix( unsigned int n
) const
968 if( n
< nP_MatrixAkt
)
969 return ppP_Matrix
[ n
];
971 printf ("GETMATRIX %d >= %d\n", n
, nP_MatrixAkt
);
975 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */