/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
SbxVariableRef refVar; const sal_Unicode* p = SkipWhitespace( *ppBuf ); if( BasicCharClass::isAlpha( *p, bCompatible ) || *p == '_' || *p == '[' )
{ // Read in the element
refVar = Element( pObj, pGbl, &p, t, bCompatible ); while( refVar.is() && (*p == '.' || *p == '!') )
{ // It follows still an objectelement. The current element // had to be a SBX-Object or had to deliver such an object!
pObj = dynamic_cast<SbxObject*>( refVar.get() ); if( !pObj ) // Then it had to deliver an object
pObj = dynamic_cast<SbxObject*>( refVar->GetObject() );
refVar.clear(); if( !pObj ) break;
p++; // And the next element please
refVar = Element( pObj, pGbl, &p, t, bCompatible );
}
} else
SbxBase::SetError( ERRCODE_BASIC_SYNTAX );
*ppBuf = p; return refVar;
}
// Read in of an operand. This could be a number, a string or // a function (with optional parameters).
// Read in of an element. This is a symbol, optional followed // by a parameter list. The symbol will be searched in the // specified object and the parameter list will be attached if necessary.
static SbxVariableRef Element
( SbxObject* pObj, SbxObject* pGbl, const sal_Unicode** ppBuf,
SbxClassType t, bool bCompatible )
{
OUString aSym; const sal_Unicode* p = Symbol( *ppBuf, aSym, bCompatible );
SbxVariableRef refVar; if( !aSym.isEmpty() )
{
SbxFlagBits nOld = pObj->GetFlags(); if( pObj == pGbl )
{
pObj->SetFlag( SbxFlagBits::GlobalSearch );
}
refVar = pObj->Find( aSym, t );
pObj->SetFlags( nOld ); if( refVar.is() )
{
refVar->SetParameters( nullptr ); // Follow still parameter?
p = SkipWhitespace( p ); if( *p == '(' )
{
p++; auto refPar = tools::make_ref<SbxArray>();
sal_uInt32 nArg = 0; // We are once relaxed and accept as well // the line- or command end as delimiter // Search parameter always global! while( *p && *p != ')' && *p != ']' )
{
SbxVariableRef refArg = PlusMinus( pGbl, pGbl, &p, bCompatible ); if( !refArg.is() )
{ // Error during the parsing
refVar.clear(); break;
} else
{ // One copies the parameter, so that // one have the current status (triggers also // the call per access)
refPar->Put(new SbxVariable(*refArg), ++nArg);
}
p = SkipWhitespace( p ); if( *p == ',' )
p++;
} if( *p == ')' )
p++; if( refVar.is() )
refVar->SetParameters( refPar.get() );
}
} else
SbxBase::SetError( ERRCODE_BASIC_NO_METHOD, aSym );
}
*ppBuf = p; return refVar;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.