update dev300-m58
[ooovba.git] / sc / source / filter / inc / xename.hxx
blob1c6f5e32b28b8dc136c06c5ab1d297ae9def7d7a
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xename.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef SC_XENAME_HXX
32 #define SC_XENAME_HXX
34 #include "xerecord.hxx"
35 #include "xlname.hxx"
36 #include "xlformula.hxx"
37 #include "xeroot.hxx"
39 // ============================================================================
41 class ScRangeList;
42 class XclExpNameManagerImpl;
44 /** Manager that stores all internal defined names (NAME records) of the document. */
45 class XclExpNameManager : public XclExpRecordBase, protected XclExpRoot
47 public:
48 explicit XclExpNameManager( const XclExpRoot& rRoot );
49 virtual ~XclExpNameManager();
51 /** Creates NAME records for built-in and user defined names. */
52 void Initialize();
54 /** Inserts the Calc name with the passed index and returns the Excel NAME index. */
55 sal_uInt16 InsertName( USHORT nScNameIdx );
56 /** Inserts the Calc database range with the passed index and returns the Excel NAME index. */
57 sal_uInt16 InsertDBRange( USHORT nScDBRangeIdx );
59 //UNUSED2009-05 /** Inserts a new built-in defined name. */
60 //UNUSED2009-05 sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, XclTokenArrayRef xTokArr, SCTAB nScTab );
61 /** Inserts a new built-in defined name, referring to the passed sheet range. */
62 sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, const ScRange& rRange );
63 /** Inserts a new built-in defined name, referring to the passed sheet range list. */
64 sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, const ScRangeList& rRangeList );
66 /** Inserts a new defined name. Sets another unused name, if rName already exists. */
67 sal_uInt16 InsertUniqueName( const String& rName, XclTokenArrayRef xTokArr, SCTAB nScTab );
68 /** Returns index of an existing name, or creates a name without definition. */
69 sal_uInt16 InsertRawName( const String& rName );
70 /** Searches or inserts a defined name describing a macro name.
71 @param bVBasic true = Visual Basic macro, false = Sheet macro.
72 @param bFunc true = Macro function; false = Macro procedure. */
73 sal_uInt16 InsertMacroCall( const String& rMacroName, bool bVBasic, bool bFunc, bool bHidden = false );
75 /** Returns the Calc sheet of a local defined name, or SCTAB_GLOBAL for global defined names. */
76 const String& GetOrigName( sal_uInt16 nNameIdx ) const;
77 /** Returns the Calc sheet of a local defined name, or SCTAB_GLOBAL for global defined names. */
78 SCTAB GetScTab( sal_uInt16 nNameIdx ) const;
79 /** Returns true, if the specified defined name is volatile. */
80 bool IsVolatile( sal_uInt16 nNameIdx ) const;
82 /** Writes the entire list of NAME records. */
83 virtual void Save( XclExpStream& rStrm );
84 virtual void SaveXml( XclExpXmlStream& rStrm );
86 private:
87 typedef ScfRef< XclExpNameManagerImpl > XclExpNameMgrImplRef;
88 XclExpNameMgrImplRef mxImpl;
91 // ============================================================================
93 #endif