From aaea9070aeb252eaba9c94770ed88b5af9f77b5a Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Wed, 28 Sep 2005 10:45:24 +0000 Subject: INTEGRATION: CWS dr37 (1.3.36); FILE MERGED 2005/04/19 14:47:16 dr 1.3.36.1: #i47228# svExternal/ocMacro tokens can be macro calls or missing defined names --- sc/source/filter/excel/xename.cxx | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'sc/source/filter/excel/xename.cxx') diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index 5e65c2f43621..7525b6dbab77 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -4,9 +4,9 @@ * * $RCSfile: xename.cxx,v $ * - * $Revision: 1.4 $ + * $Revision: 1.5 $ * - * last change: $Author: rt $ $Date: 2005-09-08 19:00:56 $ + * last change: $Author: hr $ $Date: 2005-09-28 11:45:24 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -148,6 +148,8 @@ public: sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, XclExpTokenArrayRef xTokArr, SCTAB nScTab ); /** Inserts a new defined name. Sets another unused name, if rName already exists. */ sal_uInt16 InsertUniqueName( const String& rName, XclExpTokenArrayRef xTokArr, SCTAB nScTab ); + /** Returns index of an existing name, or creates a name without definition. */ + sal_uInt16 InsertRawName( const String& rName ); /** Searches or inserts a defined name describing a macro name. @param bFunc true = Macro function; false = Macro procedure. */ sal_uInt16 InsertMacroCall( const String& rMacroName, bool bFunc ); @@ -378,6 +380,25 @@ sal_uInt16 XclExpNameManagerImpl::InsertUniqueName( return Append( xName ); } +sal_uInt16 XclExpNameManagerImpl::InsertRawName( const String& rName ) +{ + // empty name? may occur in broken external Calc tokens + if( !rName.Len() ) + return 0; + + // try to find an existing NAME record, regardless of its type + for( size_t nListIdx = mnFirstUserIdx, nListSize = maNameList.Size(); nListIdx < nListSize; ++nListIdx ) + { + XclExpNameRef xName = maNameList.GetRecord( nListIdx ); + if( xName->IsGlobal() && (xName->GetOrigName() == rName) ) + return static_cast< sal_uInt16 >( nListIdx + 1 ); + } + + // create a new NAME record + XclExpNameRef xName( new XclExpName( GetRoot(), rName ) ); + return Append( xName ); +} + sal_uInt16 XclExpNameManagerImpl::InsertMacroCall( const String& rMacroName, bool bFunc ) { // empty name? may occur in broken external Calc tokens @@ -671,6 +692,11 @@ sal_uInt16 XclExpNameManager::InsertUniqueName( return mxImpl->InsertUniqueName( rName, xTokArr, nScTab ); } +sal_uInt16 XclExpNameManager::InsertRawName( const String& rName ) +{ + return mxImpl->InsertRawName( rName ); +} + sal_uInt16 XclExpNameManager::InsertMacroCall( const String& rMacroName, bool bFunc ) { return mxImpl->InsertMacroCall( rMacroName, bFunc ); -- cgit v1.2.3