20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_TOKSTACK_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_TOKSTACK_HXX
23 #include <tokenarray.hxx>
32 class SharedStringPool;
49 operator const sal_uInt16&()
const {
return nId; }
71 template<
typename T,
int InitialCapacity>
79 ppP_Str( new T[InitialCapacity] ),
80 m_capacity(InitialCapacity),
84 bool Grow(sal_uInt16 nByMin = 1)
86 sal_uInt16 nP_StrNew =
lcl_canGrow(m_capacity, nByMin);
90 T* ppP_StrNew =
new T[ nP_StrNew ];
93 ppP_StrNew[
i ] = std::move(ppP_Str[
i ]);
95 m_capacity = nP_StrNew;
97 ppP_Str.reset( ppP_StrNew );
101 static sal_uInt16
lcl_canGrow( sal_uInt16 nOld, sal_uInt16 nByMin )
104 return nByMin ? nByMin : 1;
107 sal_uInt32 nNew = ::std::max( static_cast<sal_uInt32>(nOld) * 2,
108 static_cast<sal_uInt32>(nOld) + nByMin);
111 if (nNew - nByMin < nOld)
113 return static_cast<sal_uInt16
>(nNew);
117 return ( n < m_capacity ) ? &ppP_Str[ n ] :
nullptr;
146 std::unique_ptr<sal_uInt16[]>
pP_Id;
156 eId( e ), aText( r ){}
204 std::unique_ptr<sal_uInt16[]>
pSize;
268 static const sal_uInt16
nSize = 1024;
287 SAL_WARN(
"sc.filter",
"*TokenStack::Get(): is empty, is empty, ...");
308 SAL_WARN(
"sc.filter",
"*TokenStack::<<(): Stack overflow for " << static_cast<sal_uInt16>(rNewId));
323 SAL_WARN(
"sc.filter",
"*TokenStack::>>(): is empty, is empty, ...");
338 sal_uInt16
nId =
static_cast<sal_uInt16
>(rId);
342 SAL_WARN(
"sc.filter",
"-TokenPool::operator <<: TokenId 0");
347 SAL_WARN(
"sc.filter",
"-TokenPool::operator <<: TokenId in DefToken-Range! " << static_cast<sal_uInt16>(rId));
366 if (static_cast<sal_uInt32>(eId) +
nScTokenOff >= 0xFFFF)
368 SAL_WARN(
"sc.filter",
"-TokenPool::operator<<: enum too large! " << static_cast<sal_uInt32>(eId));
385 sal_uInt16
nId =
static_cast<sal_uInt16
>(rStack.
Get());
413 std::unique_ptr<ScTokenArray> pScToken(
new ScTokenArray(rDoc) );
420 GetElement( static_cast<sal_uInt16>(rId) - 1, pScToken.get());
Matrix data type that can store values of mixed types.
TokenPoolPool< std::unique_ptr< OUString >, 4 > ppP_Str
svl::SharedStringPool & mrStringPool
std::unique_ptr< T[]> ppP_Str
std::unique_ptr< sal_uInt16[]> pElement
std::unique_ptr< sal_uInt16[]> pP_Id
bool GetElementRek(const sal_uInt16 nId, ScTokenArray *pScToken)
TokenId & operator=(const TokenId &r)
bool GrowTripel(sal_uInt16 nByMin)
Single reference (one address) into the sheet.
TokenPoolPool< std::unique_ptr< EXTCONT >, 32 > ppP_Ext
std::unique_ptr< ScMatrix *[]> ppP_Matrix
sal_uInt16 nP_MatrixCurrent
TokenId StoreExtName(sal_uInt16 nFileId, const OUString &rName)
TokenPoolPool< std::unique_ptr< ScSingleRefData >, 16 > ppP_Nlf
std::unique_ptr< E_TYPE[]> pType
for storage of external area references
const OUString * GetExternal(const TokenId &rId) const
bool GetElement(const sal_uInt16 nId, ScTokenArray *pScToken)
TokenPool(svl::SharedStringPool &rSPool)
bool HasMoreTokens() const
TokenId StoreNlf(const ScSingleRefData &rTr)
sal_uInt16 nElementCurrent
::std::vector< RangeName > maRangeNames
for storage of named ranges
T & operator[](sal_uInt16 n)
static const sal_uInt16 nSize
TokenId(const TokenId &r)
static const sal_uInt16 nScTokenOff
std::unique_ptr< TokenId[]> pStack
EXTCONT(const DefTokenId e, const OUString &r)
bool IsSingleOp(const TokenId &rId, const DefTokenId eId) const
static sal_uInt16 lcl_canGrow(sal_uInt16 nOld, sal_uInt16 nByMin)
Returns the new number of elements, or 0 if overflow.
void operator>>(TokenId &rId)
ScMatrix * GetMatrix(unsigned int n) const
TokenId StoreName(sal_uInt16 nIndex, sal_Int16 nSheet)
T * getIfInRange(sal_uInt16 n) const
for storage of external cell references
std::unique_ptr< ScTokenArray > GetTokenArray(const ScDocument &rDoc, const TokenId &rId)
::std::vector< ExtCellRef > maExtCellRefs
TokenPoolPool< sal_uInt16, 8 > pP_Err
bool Grow(sal_uInt16 nByMin=1)
::std::vector< ExtAreaRef > maExtAreaRefs
T const & operator[](sal_uInt16 n) const
std::unique_ptr< sal_uInt16[]> pSize
These need to be in global namespace just like their respective types are.
TokenId StoreExtRef(sal_uInt16 nFileId, const OUString &rTabName, const ScSingleRefData &rRef)
Complex reference (a range) into the sheet.
::std::vector< ExtName > maExtNames
for storage of external names
#define SAL_WARN(area, stream)
bool CheckElementOrGrow()
TokenStack & operator<<(const TokenId &rNewId)
TokenPoolPool< std::unique_ptr< ScSingleRefData >, 32 > ppP_RefTr
void operator>>(TokenId &rId)
TokenPool & operator<<(const TokenId &rId)
TokenPoolPool< double, 8 > pP_Dbl