/* -*- 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 .
*/
private:
OUString aName;
OUString aUpperName; // #i62977# for faster searching (aName is never modified after ctor)
OUString maNewName; ///< used for formulas after changing names in the dialog
std::unique_ptr<ScTokenArray>
pCode;
ScAddress aPos;
Type eType;
ScDocument& rDoc;
formula::FormulaGrammar::Grammar eTempGrammar; // needed for unresolved XML compiles
sal_uInt16 nIndex; bool bModified; // is set/cleared by UpdateReference
/* Exact copy, not recompiled, no other index (!), nothing... except if * pDocument or pPos are passed, those values are assigned instead of the
* copies. */
ScRangeData( const ScRangeData& rScRangeData, ScDocument* pDocument = nullptr, constScAddress* pPos = nullptr );
SC_DLLPUBLIC ~ScRangeData();
booloperator== (const ScRangeData& rData) const;
void GetName( OUString& rName ) const { rName = maNewName.isEmpty() ? aName : maNewName; } const OUString& GetName() const { return maNewName.isEmpty() ? aName : maNewName; } const OUString& GetUpperName() const { return aUpperName; } const ScAddress& GetPos() const { return aPos; } // The index has to be unique. If index=0 a new index value is assigned. void SetIndex( sal_uInt16 nInd ) { nIndex = nInd; }
sal_uInt16 GetIndex() const { return nIndex; } /// Does not change the name, but sets maNewName for formula update after dialog. void SetNewName( const OUString& rNewName ) { maNewName = rNewName; }
ScTokenArray* GetCode() { return pCode.get(); }
SC_DLLPUBLIC void SetCode( const ScTokenArray& ); const ScTokenArray* GetCode() const { return pCode.get(); }
SC_DLLPUBLIC FormulaError GetErrCode() const; bool HasReferences() const; void AddType( Type nType );
Type GetType() const { return eType; } bool HasType( Type nType ) const;
SC_DLLPUBLIC sal_uInt32 GetUnoType() const;
SC_DLLPUBLIC OUString GetSymbol( const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const;
SC_DLLPUBLIC OUString GetSymbol( const ScAddress& rPos, const formula::FormulaGrammar::Grammar eGrammar = formula::FormulaGrammar::GRAM_DEFAULT ) const; void UpdateSymbol( OUStringBuffer& rBuffer, const ScAddress& );
/** * @param nLocalTab sheet index where this name belongs, or -1 for global * name.
*/ void UpdateReference( sc::RefUpdateContext& rCxt, SCTAB nLocalTab ); bool IsModified() const { return bModified; }
class ScRangeName
{ private: typedef std::vector<ScRangeData*> IndexDataType; typedef ::std::map<OUString, std::unique_ptr<ScRangeData>> DataType;
DataType m_Data;
IndexDataType maIndexToData; // Use for optimization, true if any of the contained names resolves // as a valid cell address (e.g. 'day1' with 16k columns). mutablebool mHasPossibleAddressConflict : 1; mutablebool mHasPossibleAddressConflictDirty : 1;
void checkHasPossibleAddressConflict() const;
public: /// Map that stores non-managed pointers to ScRangeName instances. typedef ::std::map<SCTAB, const ScRangeName*> TabNameCopyMap;
/** Compile those names that couldn't be resolved during loading and inserting because they may have referred a name that was inserted later.
*/ void CompileUnresolvedXML( sc::CompileFormulaContext& rCxt );
/** Copy names while copying a sheet if they reference the sheet to be copied.
Assumes that new sheet was already inserted, global names have been updated/adjusted, but sheet-local names on nOldTab are not, as is the case in ScDocument::CopyTab()
@param nLocalTab -1 when operating on global names, else sheet/tab of sheet-local name scope. The already adjusted tab on which to find the name.
@param nOldTab The original unadjusted tab position.
/** Insert object into set. @ATTENTION: The underlying ::std::map<std::unique_ptr>::insert(p) takes ownership of p and if it can't insert it deletes the object! So, if this insert here returns false the object where p pointed to is gone!
@param bReuseFreeIndex If the ScRangeData p points to has an index value of 0: If `TRUE` then reuse a free index slot if available. If `FALSE` then assign a new index slot. The Manage Names dialog uses this so that deleting and adding ranges in the same run is guaranteed to not reuse previously assigned indexes.
*/
SC_DLLPUBLIC bool insert( ScRangeData* p, bool bReuseFreeIndex = true );
/** * Erase by iterator position. Note that this method doesn't check for * iterator's validity. The caller must make sure that the iterator is * valid.
*/ void erase(const_iterator itr);
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.