1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: xiname.hxx,v $
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 ************************************************************************/
41 // ============================================================================
45 /** Represents a defined name. It may be related to a single sheet or global. */
46 class XclImpName
: protected XclImpRoot
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
; }
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
74 class XclImpNameManager
: protected XclImpRoot
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;
94 typedef ScfDelList
< XclImpName
> XclImpNameList
;
95 XclImpNameList maNameList
;
98 // ============================================================================