Update ooo320-m1
[ooovba.git] / sc / source / filter / inc / xiname.hxx
blob3c2952892d693367d43d0740c2e4733c80332e25
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: xiname.hxx,v $
10 * $Revision: 1.5 $
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_XINAME_HXX
32 #define SC_XINAME_HXX
34 #include <map>
35 #include "xlname.hxx"
36 #include "xiroot.hxx"
38 //class ScDocument;
39 //class ScTokenArray;
41 // ============================================================================
43 class ScRangeData;
45 /** Represents a defined name. It may be related to a single sheet or global. */
46 class XclImpName : protected XclImpRoot
48 public:
49 explicit XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx );
51 inline const String& GetXclName() const { return maXclName; }
52 inline const String& GetScName() const { return maScName; }
53 inline SCTAB GetScTab() const { return mnScTab; }
54 inline const ScRangeData* GetScRangeData() const { return mpScData; }
55 inline bool IsGlobal() const { return mnScTab == SCTAB_MAX; }
56 inline bool IsVBName() const { return mbVBName; }
58 private:
59 String maXclName; /// Original name read from the file.
60 String maScName; /// Name inserted into the Calc document.
61 const ScRangeData* mpScData; /// Pointer to Calc defined name (no ownership).
62 sal_Unicode mcBuiltIn; /// Excel built-in name index.
63 SCTAB mnScTab; /// Calc sheet index of local names.
64 bool mbVBName; /// true = Visual Basic procedure.
67 // ----------------------------------------------------------------------------
69 /** This buffer contains all internal defined names of the document.
70 @descr It manages the position of the names in the document, means if they are
71 global or attached to a specific sheet. While inserting the names into the Calc
72 document this buffer resolves conflicts caused by equal names from different
73 sheets. */
74 class XclImpNameManager : protected XclImpRoot
76 public:
77 explicit XclImpNameManager( const XclImpRoot& rRoot );
79 /** Reads a NAME record and creates an entry in this buffer. */
80 void ReadName( XclImpStream& rStrm );
82 /** Tries to find the name used in Calc, based on the original Excel defined name.
83 @param nScTab The sheet index for local names or SCTAB_MAX for global names.
84 If no local name is found, tries to find a matching global name.
85 @return Pointer to the defined name or 0 on error. */
86 const XclImpName* FindName( const String& rXclName, SCTAB nScTab = SCTAB_MAX ) const;
88 /** Returns the defined name specified by its Excel index.
89 @param nXclNameIdx The index of the internal defined name.
90 @return Pointer to the defined name or 0 on error. */
91 const XclImpName* GetName( sal_uInt16 nXclNameIdx ) const;
93 private:
94 typedef ScfDelList< XclImpName > XclImpNameList;
95 XclImpNameList maNameList;
98 // ============================================================================
100 #endif