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 .
20 #include "tokstack.hxx"
21 #include "compiler.hxx"
23 #include "scmatrix.hxx"
25 #include <svl/sharedstringpool.hxx>
30 const sal_uInt16
TokenPool::nScTokenOff
= 8192;
32 TokenStack::TokenStack( sal_uInt16 nNewSize
)
34 pStack
= new TokenId
[ nNewSize
];
40 TokenStack::~TokenStack()
45 // !ATTENTION!": to the outside the numbering starts with 1!
46 // !ATTENTION!": SC-Token are stored with an offset nScTokenOff
47 // -> to distinguish from other tokens
49 TokenPool::TokenPool( svl::SharedStringPool
& rSPool
) :
52 sal_uInt16 nLauf
= nScTokenOff
;
54 // pool for Id-sequences
56 pP_Id
= new sal_uInt16
[ nP_Id
];
60 pElement
= new sal_uInt16
[ nElement
];
61 pType
= new E_TYPE
[ nElement
];
62 pSize
= new sal_uInt16
[ nElement
];
67 ppP_Str
= new OUString
*[ nP_Str
];
68 for( nLauf
= 0 ; nLauf
< nP_Str
; nLauf
++ )
69 ppP_Str
[ nLauf
] = NULL
;
73 pP_Dbl
= new double[ nP_Dbl
];
75 // pool for error codes
77 pP_Err
= new sal_uInt16
[ nP_Err
];
79 // pool for References
81 ppP_RefTr
= new ScSingleRefData
*[ nP_RefTr
];
82 for( nLauf
= 0 ; nLauf
< nP_RefTr
; nLauf
++ )
83 ppP_RefTr
[ nLauf
] = NULL
;
86 ppP_Ext
= new EXTCONT
*[ nP_Ext
];
87 memset( ppP_Ext
, 0, sizeof( EXTCONT
* ) * nP_Ext
);
90 ppP_Nlf
= new NLFCONT
*[ nP_Nlf
];
91 memset( ppP_Nlf
, 0, sizeof( NLFCONT
* ) * nP_Nlf
);
94 ppP_Matrix
= new ScMatrix
*[ nP_Matrix
];
95 memset( ppP_Matrix
, 0, sizeof( ScMatrix
* ) * nP_Matrix
);
97 pScToken
= new ScTokenArray
;
102 TokenPool::~TokenPool()
113 for( n
= 0 ; n
< nP_RefTr
; n
++ )
114 delete ppP_RefTr
[ n
];
117 for( n
= 0 ; n
< nP_Str
; n
++ )
121 for( n
= 0 ; n
< nP_Ext
; n
++ )
125 for( n
= 0 ; n
< nP_Nlf
; n
++ )
129 for( n
= 0 ; n
< nP_Matrix
; n
++ )
131 if( ppP_Matrix
[ n
] )
132 ppP_Matrix
[ n
]->DecRef( );
139 /** Returns the new number of elements, or 0 if overflow. */
140 static sal_uInt16
lcl_canGrow( sal_uInt16 nOld
, sal_uInt16 nByMin
= 1 )
143 return nByMin
? nByMin
: 1;
144 if (nOld
== SAL_MAX_UINT16
)
146 sal_uInt32 nNew
= ::std::max( static_cast<sal_uInt32
>(nOld
) * 2,
147 static_cast<sal_uInt32
>(nOld
) + nByMin
);
148 if (nNew
> SAL_MAX_UINT16
)
149 nNew
= SAL_MAX_UINT16
;
150 if (nNew
- nByMin
< nOld
)
152 return static_cast<sal_uInt16
>(nNew
);
155 bool TokenPool::GrowString()
157 sal_uInt16 nP_StrNew
= lcl_canGrow( nP_Str
);
163 OUString
** ppP_StrNew
= new (::std::nothrow
) OUString
*[ nP_StrNew
];
167 for( nL
= 0 ; nL
< nP_Str
; nL
++ )
168 ppP_StrNew
[ nL
] = ppP_Str
[ nL
];
169 for( nL
= nP_Str
; nL
< nP_StrNew
; nL
++ )
170 ppP_StrNew
[ nL
] = NULL
;
175 ppP_Str
= ppP_StrNew
;
179 bool TokenPool::GrowDouble()
181 sal_uInt16 nP_DblNew
= lcl_canGrow( nP_Dbl
);
185 double* pP_DblNew
= new (::std::nothrow
) double[ nP_DblNew
];
189 for( sal_uInt16 nL
= 0 ; nL
< nP_Dbl
; nL
++ )
190 pP_DblNew
[ nL
] = pP_Dbl
[ nL
];
199 /* TODO: in case we had FormulaTokenArray::AddError() */
201 void TokenPool::GrowError()
203 sal_uInt16 nP_ErrNew
= lcl_canGrow( nP_Err
);
207 sal_uInt16
* pP_ErrNew
= new (::std::nothrow
) sal_uInt16
[ nP_ErrNew
];
211 for( sal_uInt16 nL
= 0 ; nL
< nP_Err
; nL
++ )
212 pP_ErrNew
[ nL
] = pP_Err
[ nL
];
222 bool TokenPool::GrowTripel( sal_uInt16 nByMin
)
224 sal_uInt16 nP_RefTrNew
= lcl_canGrow( nP_RefTr
, nByMin
);
230 ScSingleRefData
** ppP_RefTrNew
= new (::std::nothrow
) ScSingleRefData
*[ nP_RefTrNew
];
234 for( nL
= 0 ; nL
< nP_RefTr
; nL
++ )
235 ppP_RefTrNew
[ nL
] = ppP_RefTr
[ nL
];
236 for( nL
= nP_RefTr
; nL
< nP_RefTrNew
; nL
++ )
237 ppP_RefTrNew
[ nL
] = NULL
;
239 nP_RefTr
= nP_RefTrNew
;
242 ppP_RefTr
= ppP_RefTrNew
;
246 bool TokenPool::GrowId()
248 sal_uInt16 nP_IdNew
= lcl_canGrow( nP_Id
);
252 sal_uInt16
* pP_IdNew
= new (::std::nothrow
) sal_uInt16
[ nP_IdNew
];
256 for( sal_uInt16 nL
= 0 ; nL
< nP_Id
; nL
++ )
257 pP_IdNew
[ nL
] = pP_Id
[ nL
];
266 bool TokenPool::GrowElement()
268 sal_uInt16 nElementNew
= lcl_canGrow( nElement
);
272 sal_uInt16
* pElementNew
= new (::std::nothrow
) sal_uInt16
[ nElementNew
];
273 E_TYPE
* pTypeNew
= new (::std::nothrow
) E_TYPE
[ nElementNew
];
274 sal_uInt16
* pSizeNew
= new (::std::nothrow
) sal_uInt16
[ nElementNew
];
275 if (!pElementNew
|| !pTypeNew
|| !pSizeNew
)
277 delete [] pElementNew
;
283 for( sal_uInt16 nL
= 0 ; nL
< nElement
; nL
++ )
285 pElementNew
[ nL
] = pElement
[ nL
];
286 pTypeNew
[ nL
] = pType
[ nL
];
287 pSizeNew
[ nL
] = pSize
[ nL
];
290 nElement
= nElementNew
;
295 pElement
= pElementNew
;
301 bool TokenPool::GrowExt()
303 sal_uInt16 nNewSize
= lcl_canGrow( nP_Ext
);
307 EXTCONT
** ppNew
= new (::std::nothrow
) EXTCONT
*[ nNewSize
];
311 memset( ppNew
, 0, sizeof( EXTCONT
* ) * nNewSize
);
312 memcpy( ppNew
, ppP_Ext
, sizeof( EXTCONT
* ) * nP_Ext
);
320 bool TokenPool::GrowNlf()
322 sal_uInt16 nNewSize
= lcl_canGrow( nP_Nlf
);
326 NLFCONT
** ppNew
= new (::std::nothrow
) NLFCONT
*[ nNewSize
];
330 memset( ppNew
, 0, sizeof( NLFCONT
* ) * nNewSize
);
331 memcpy( ppNew
, ppP_Nlf
, sizeof( NLFCONT
* ) * nP_Nlf
);
339 bool TokenPool::GrowMatrix()
341 sal_uInt16 nNewSize
= lcl_canGrow( nP_Matrix
);
345 ScMatrix
** ppNew
= new (::std::nothrow
) ScMatrix
*[ nNewSize
];
349 memset( ppNew
, 0, sizeof( ScMatrix
* ) * nNewSize
);
350 memcpy( ppNew
, ppP_Matrix
, sizeof( ScMatrix
* ) * nP_Matrix
);
354 nP_Matrix
= nNewSize
;
358 bool TokenPool::GetElement( const sal_uInt16 nId
)
360 OSL_ENSURE( nId
< nElementAkt
, "*TokenPool::GetElement(): Id too large!?" );
361 if (nId
>= nElementAkt
)
365 if( pType
[ nId
] == T_Id
)
366 bRet
= GetElementRek( nId
);
369 switch( pType
[ nId
] )
373 sal_uInt16 n
= pElement
[ nId
];
374 OUString
* p
= ( n
< nP_Str
)? ppP_Str
[ n
] : NULL
;
376 pScToken
->AddString(mrStringPool
.intern(*p
));
383 sal_uInt16 n
= pElement
[ nId
];
385 pScToken
->AddDouble( pP_Dbl
[ n
] );
391 /* TODO: in case we had FormulaTokenArray::AddError() */
394 sal_uInt16 n
= pElement
[ nId
];
396 pScToken
->AddError( pP_Err
[ n
] );
404 sal_uInt16 n
= pElement
[ nId
];
405 ScSingleRefData
* p
= ( n
< nP_RefTr
)? ppP_RefTr
[ n
] : NULL
;
407 pScToken
->AddSingleReference( *p
);
414 sal_uInt16 n
= pElement
[ nId
];
415 if (n
< nP_RefTr
&& ppP_RefTr
[ n
] && n
+1 < nP_RefTr
&& ppP_RefTr
[ n
+ 1 ])
417 ScComplexRefData aScComplexRefData
;
418 aScComplexRefData
.Ref1
= *ppP_RefTr
[ n
];
419 aScComplexRefData
.Ref2
= *ppP_RefTr
[ n
+ 1 ];
420 pScToken
->AddDoubleReference( aScComplexRefData
);
428 sal_uInt16 n
= pElement
[nId
];
429 if (n
< maRangeNames
.size())
431 const RangeName
& r
= maRangeNames
[n
];
432 pScToken
->AddRangeName(r
.mnIndex
, r
.mbGlobal
);
438 sal_uInt16 n
= pElement
[ nId
];
439 EXTCONT
* p
= ( n
< nP_Ext
)? ppP_Ext
[ n
] : NULL
;
443 if( p
->eId
== ocEuroConvert
)
444 pScToken
->AddOpCode( p
->eId
);
446 pScToken
->AddExternal( p
->aText
, p
->eId
);
454 sal_uInt16 n
= pElement
[ nId
];
455 NLFCONT
* p
= ( n
< nP_Nlf
)? ppP_Nlf
[ n
] : NULL
;
458 pScToken
->AddColRowName( p
->aRef
);
465 sal_uInt16 n
= pElement
[ nId
];
466 ScMatrix
* p
= ( n
< nP_Matrix
)? ppP_Matrix
[ n
] : NULL
;
469 pScToken
->AddMatrix( p
);
476 sal_uInt16 n
= pElement
[nId
];
477 if (n
< maExtNames
.size())
479 const ExtName
& r
= maExtNames
[n
];
480 pScToken
->AddExternalName(r
.mnFileId
, r
.maName
);
488 sal_uInt16 n
= pElement
[nId
];
489 if (n
< maExtCellRefs
.size())
491 const ExtCellRef
& r
= maExtCellRefs
[n
];
492 pScToken
->AddExternalSingleReference(r
.mnFileId
, r
.maTabName
, r
.maRef
);
500 sal_uInt16 n
= pElement
[nId
];
501 if (n
< maExtAreaRefs
.size())
503 const ExtAreaRef
& r
= maExtAreaRefs
[n
];
504 pScToken
->AddExternalDoubleReference(r
.mnFileId
, r
.maTabName
, r
.maRef
);
511 OSL_FAIL("-TokenPool::GetElement(): undefined state!?");
518 bool TokenPool::GetElementRek( const sal_uInt16 nId
)
522 OSL_ENSURE(m_nRek
<= nP_Id
, "*TokenPool::GetElement(): recursion loops!?");
525 OSL_ENSURE( nId
< nElementAkt
, "*TokenPool::GetElementRek(): nId >= nElementAkt" );
527 if (nId
>= nElementAkt
)
529 SAL_WARN("sc.filter", "*TokenPool::GetElementRek(): nId >= nElementAkt");
536 if (pType
[ nId
] != T_Id
)
538 SAL_WARN("sc.filter", "-TokenPool::GetElementRek(): pType[ nId ] != T_Id");
546 sal_uInt16 nAnz
= pSize
[ nId
];
547 sal_uInt16 nFirstId
= pElement
[ nId
];
548 if (nFirstId
>= nP_Id
)
550 SAL_WARN("sc.filter", "TokenPool::GetElementRek: nFirstId >= nP_Id");
554 sal_uInt16
* pAkt
= nAnz
? &pP_Id
[ nFirstId
] : NULL
;
555 if (nAnz
> nP_Id
- nFirstId
)
557 SAL_WARN("sc.filter", "TokenPool::GetElementRek: nAnz > nP_Id - nFirstId");
558 nAnz
= nP_Id
- nFirstId
;
561 for( ; nAnz
> 0 ; nAnz
--, pAkt
++ )
563 if( *pAkt
< nScTokenOff
)
564 {// recursion or not?
565 if (*pAkt
>= nElementAkt
)
567 SAL_WARN("sc.filter", "TokenPool::GetElementRek: *pAkt >= nElementAkt");
572 if (pType
[ *pAkt
] == T_Id
)
573 bRet
= GetElementRek( *pAkt
);
575 bRet
= GetElement( *pAkt
);
578 else // elementary SC_Token
579 pScToken
->AddOpCode( ( DefTokenId
) ( *pAkt
- nScTokenOff
) );
588 void TokenPool::operator >>( TokenId
& rId
)
590 rId
= static_cast<TokenId
>( nElementAkt
+ 1 );
592 if( nElementAkt
>= nElement
)
596 pElement
[ nElementAkt
] = nP_IdLast
; // Start of Token-sequence
597 pType
[ nElementAkt
] = T_Id
; // set Typeinfo
598 pSize
[ nElementAkt
] = nP_IdAkt
- nP_IdLast
;
599 // write from nP_IdLast to nP_IdAkt-1 -> length of the sequence
601 nElementAkt
++; // start value for next sequence
602 nP_IdLast
= nP_IdAkt
;
605 const TokenId
TokenPool::Store( const double& rDouble
)
607 if( nElementAkt
>= nElement
)
609 return static_cast<const TokenId
>(nElementAkt
+1);
611 if( nP_DblAkt
>= nP_Dbl
)
613 return static_cast<const TokenId
>(nElementAkt
+1);
615 pElement
[ nElementAkt
] = nP_DblAkt
; // Index in Double-Array
616 pType
[ nElementAkt
] = T_D
; // set Typeinfo Double
618 pP_Dbl
[ nP_DblAkt
] = rDouble
;
620 pSize
[ nElementAkt
] = 1; // does not matter
625 return static_cast<const TokenId
>(nElementAkt
); // return old value + 1!
628 const TokenId
TokenPool::Store( const sal_uInt16 nIndex
)
630 return StoreName(nIndex
, true);
633 const TokenId
TokenPool::Store( const OUString
& rString
)
635 // mostly copied to Store( const sal_Char* ), to avoid a temporary string
636 if( nElementAkt
>= nElement
)
638 return static_cast<const TokenId
>(nElementAkt
+1);
640 if( nP_StrAkt
>= nP_Str
)
642 return static_cast<const TokenId
>(nElementAkt
+1);
644 pElement
[ nElementAkt
] = nP_StrAkt
; // Index in String-Array
645 pType
[ nElementAkt
] = T_Str
; // set Typeinfo String
648 if( !ppP_Str
[ nP_StrAkt
] )
649 //...but only, if it does not exist already
650 ppP_Str
[ nP_StrAkt
] = new (::std::nothrow
) OUString( rString
);
653 *ppP_Str
[ nP_StrAkt
] = rString
;
655 if (ppP_Str
[ nP_StrAkt
])
657 /* attention trucate to 16 bits */
658 pSize
[ nElementAkt
] = ( sal_uInt16
) ppP_Str
[ nP_StrAkt
]->getLength();
664 return static_cast<const TokenId
>(nElementAkt
); // return old value + 1!
667 const TokenId
TokenPool::Store( const ScSingleRefData
& rTr
)
669 if( nElementAkt
>= nElement
)
671 return static_cast<const TokenId
>(nElementAkt
+1);
673 if( nP_RefTrAkt
>= nP_RefTr
)
675 return static_cast<const TokenId
>(nElementAkt
+1);
677 pElement
[ nElementAkt
] = nP_RefTrAkt
;
678 pType
[ nElementAkt
] = T_RefC
; // set Typeinfo Cell-Ref
680 if( !ppP_RefTr
[ nP_RefTrAkt
] )
681 ppP_RefTr
[ nP_RefTrAkt
] = new ScSingleRefData( rTr
);
683 *ppP_RefTr
[ nP_RefTrAkt
] = rTr
;
688 return static_cast<const TokenId
>(nElementAkt
); // return old value + 1!
691 const TokenId
TokenPool::Store( const ScComplexRefData
& rTr
)
693 if( nElementAkt
>= nElement
)
695 return static_cast<const TokenId
>(nElementAkt
+1);
697 if( nP_RefTrAkt
+ 1 >= nP_RefTr
)
699 return static_cast<const TokenId
>(nElementAkt
+1);
701 pElement
[ nElementAkt
] = nP_RefTrAkt
;
702 pType
[ nElementAkt
] = T_RefA
; // setTypeinfo Area-Ref
704 if( !ppP_RefTr
[ nP_RefTrAkt
] )
705 ppP_RefTr
[ nP_RefTrAkt
] = new ScSingleRefData( rTr
.Ref1
);
707 *ppP_RefTr
[ nP_RefTrAkt
] = rTr
.Ref1
;
710 if( !ppP_RefTr
[ nP_RefTrAkt
] )
711 ppP_RefTr
[ nP_RefTrAkt
] = new ScSingleRefData( rTr
.Ref2
);
713 *ppP_RefTr
[ nP_RefTrAkt
] = rTr
.Ref2
;
718 return static_cast<const TokenId
>(nElementAkt
); // return old value + 1!
721 const TokenId
TokenPool::Store( const DefTokenId e
, const OUString
& r
)
723 if( nElementAkt
>= nElement
)
725 return static_cast<const TokenId
>(nElementAkt
+1);
727 if( nP_ExtAkt
>= nP_Ext
)
729 return static_cast<const TokenId
>(nElementAkt
+1);
731 pElement
[ nElementAkt
] = nP_ExtAkt
;
732 pType
[ nElementAkt
] = T_Ext
; // set Typeinfo String
734 if( ppP_Ext
[ nP_ExtAkt
] )
736 ppP_Ext
[ nP_ExtAkt
]->eId
= e
;
737 ppP_Ext
[ nP_ExtAkt
]->aText
= r
;
740 ppP_Ext
[ nP_ExtAkt
] = new EXTCONT( e
, r
);
745 return static_cast<const TokenId
>(nElementAkt
); // return old value + 1!
748 const TokenId
TokenPool::StoreNlf( const ScSingleRefData
& rTr
)
750 if( nElementAkt
>= nElement
)
752 return static_cast<const TokenId
>(nElementAkt
+1);
754 if( nP_NlfAkt
>= nP_Nlf
)
756 return static_cast<const TokenId
>(nElementAkt
+1);
758 pElement
[ nElementAkt
] = nP_NlfAkt
;
759 pType
[ nElementAkt
] = T_Nlf
;
761 if( ppP_Nlf
[ nP_NlfAkt
] )
763 ppP_Nlf
[ nP_NlfAkt
]->aRef
= rTr
;
766 ppP_Nlf
[ nP_NlfAkt
] = new NLFCONT( rTr
);
771 return static_cast<const TokenId
>(nElementAkt
);
774 const TokenId
TokenPool::StoreMatrix()
778 if( nElementAkt
>= nElement
)
780 return static_cast<const TokenId
>(nElementAkt
+1);
782 if( nP_MatrixAkt
>= nP_Matrix
)
784 return static_cast<const TokenId
>(nElementAkt
+1);
786 pElement
[ nElementAkt
] = nP_MatrixAkt
;
787 pType
[ nElementAkt
] = T_Matrix
;
789 pM
= new ScMatrix( 0, 0 );
791 ppP_Matrix
[ nP_MatrixAkt
] = pM
;
796 return static_cast<const TokenId
>(nElementAkt
);
799 const TokenId
TokenPool::StoreName( sal_uInt16 nIndex
, bool bGlobal
)
801 if ( nElementAkt
>= nElement
)
803 return static_cast<const TokenId
>(nElementAkt
+1);
805 pElement
[nElementAkt
] = static_cast<sal_uInt16
>(maRangeNames
.size());
806 pType
[nElementAkt
] = T_RN
;
808 maRangeNames
.push_back(RangeName());
809 RangeName
& r
= maRangeNames
.back();
811 r
.mbGlobal
= bGlobal
;
815 return static_cast<const TokenId
>(nElementAkt
);
818 const TokenId
TokenPool::StoreExtName( sal_uInt16 nFileId
, const OUString
& rName
)
820 if ( nElementAkt
>= nElement
)
822 return static_cast<const TokenId
>(nElementAkt
+1);
824 pElement
[nElementAkt
] = static_cast<sal_uInt16
>(maExtNames
.size());
825 pType
[nElementAkt
] = T_ExtName
;
827 maExtNames
.push_back(ExtName());
828 ExtName
& r
= maExtNames
.back();
829 r
.mnFileId
= nFileId
;
834 return static_cast<const TokenId
>(nElementAkt
);
837 const TokenId
TokenPool::StoreExtRef( sal_uInt16 nFileId
, const OUString
& rTabName
, const ScSingleRefData
& rRef
)
839 if ( nElementAkt
>= nElement
)
841 return static_cast<const TokenId
>(nElementAkt
+1);
843 pElement
[nElementAkt
] = static_cast<sal_uInt16
>(maExtCellRefs
.size());
844 pType
[nElementAkt
] = T_ExtRefC
;
846 maExtCellRefs
.push_back(ExtCellRef());
847 ExtCellRef
& r
= maExtCellRefs
.back();
848 r
.mnFileId
= nFileId
;
849 r
.maTabName
= rTabName
;
854 return static_cast<const TokenId
>(nElementAkt
);
857 const TokenId
TokenPool::StoreExtRef( sal_uInt16 nFileId
, const OUString
& rTabName
, const ScComplexRefData
& rRef
)
859 if ( nElementAkt
>= nElement
)
861 return static_cast<const TokenId
>(nElementAkt
+1);
863 pElement
[nElementAkt
] = static_cast<sal_uInt16
>(maExtAreaRefs
.size());
864 pType
[nElementAkt
] = T_ExtRefA
;
866 maExtAreaRefs
.push_back(ExtAreaRef());
867 ExtAreaRef
& r
= maExtAreaRefs
.back();
868 r
.mnFileId
= nFileId
;
869 r
.maTabName
= rTabName
;
874 return static_cast<const TokenId
>(nElementAkt
);
877 void TokenPool::Reset()
879 nP_IdAkt
= nP_IdLast
= nElementAkt
= nP_StrAkt
= nP_DblAkt
= nP_ErrAkt
= nP_RefTrAkt
= nP_ExtAkt
= nP_NlfAkt
= nP_MatrixAkt
= 0;
880 maRangeNames
.clear();
882 maExtCellRefs
.clear();
883 maExtAreaRefs
.clear();
886 bool TokenPool::IsSingleOp( const TokenId
& rId
, const DefTokenId eId
) const
888 sal_uInt16 nId
= (sal_uInt16
) rId
;
889 if( nId
&& nId
<= nElementAkt
)
892 if( T_Id
== pType
[ nId
] )
894 if( pSize
[ nId
] == 1 )
896 sal_uInt16 nPid
= pElement
[ nId
];
899 sal_uInt16 nSecId
= pP_Id
[ nPid
];
900 if( nSecId
>= nScTokenOff
)
902 return ( DefTokenId
) ( nSecId
- nScTokenOff
) == eId
; // wanted?
912 const OUString
* TokenPool::GetExternal( const TokenId
& rId
) const
914 const OUString
* p
= NULL
;
915 sal_uInt16 n
= (sal_uInt16
) rId
;
916 if( n
&& n
<= nElementAkt
)
919 if( pType
[ n
] == T_Ext
)
921 sal_uInt16 nExt
= pElement
[ n
];
922 if ( nExt
< nP_Ext
&& ppP_Ext
[ nExt
] )
923 p
= &ppP_Ext
[ nExt
]->aText
;
930 ScMatrix
* TokenPool::GetMatrix( unsigned int n
) const
932 if( n
< nP_MatrixAkt
)
933 return ppP_Matrix
[ n
];
935 printf ("GETMATRIX %d >= %d\n", n
, nP_MatrixAkt
);
939 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */