Stop leaking all ScPostIt instances.
[LibreOffice.git] / sc / source / filter / inc / xename.hxx
blob3d4c1f9d832f5c38e922aab83f72eed0db462337
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef SC_XENAME_HXX
21 #define SC_XENAME_HXX
23 #include "xerecord.hxx"
24 #include "xlname.hxx"
25 #include "xlformula.hxx"
26 #include "xeroot.hxx"
27 #include <boost/shared_ptr.hpp>
29 // ============================================================================
31 class ScRangeList;
32 class XclExpNameManagerImpl;
34 /** Manager that stores all internal defined names (NAME records) of the document. */
35 class XclExpNameManager : public XclExpRecordBase, protected XclExpRoot
37 public:
38 explicit XclExpNameManager( const XclExpRoot& rRoot );
39 virtual ~XclExpNameManager();
41 /** Creates NAME records for built-in and user defined names. */
42 void Initialize();
44 /** Inserts the Calc name with the passed index and returns the Excel NAME index. */
45 sal_uInt16 InsertName( SCTAB nTab, sal_uInt16 nScNameIdx );
46 /** Inserts the Calc database range with the passed index and returns the Excel NAME index. */
47 sal_uInt16 InsertDBRange( sal_uInt16 nScDBRangeIdx );
49 /** Inserts a new built-in defined name, referring to the passed sheet range. */
50 sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, const ScRange& rRange );
51 /** Inserts a new built-in defined name, referring to the passed sheet range list. */
52 sal_uInt16 InsertBuiltInName( sal_Unicode cBuiltIn, const ScRangeList& rRangeList );
54 /** Inserts a new defined name. Sets another unused name, if rName already exists. */
55 sal_uInt16 InsertUniqueName( const OUString& rName, XclTokenArrayRef xTokArr, SCTAB nScTab );
56 /** Returns index of an existing name, or creates a name without definition. */
57 sal_uInt16 InsertRawName( const OUString& rName );
58 /** Searches or inserts a defined name describing a macro name.
59 @param bVBasic true = Visual Basic macro, false = Sheet macro.
60 @param bFunc true = Macro function; false = Macro procedure. */
61 sal_uInt16 InsertMacroCall( const OUString& rMacroName, bool bVBasic, bool bFunc, bool bHidden = false );
63 /** Returns the Calc sheet of a local defined name, or SCTAB_GLOBAL for global defined names. */
64 const OUString& GetOrigName( sal_uInt16 nNameIdx ) const;
65 /** Returns the Calc sheet of a local defined name, or SCTAB_GLOBAL for global defined names. */
66 SCTAB GetScTab( sal_uInt16 nNameIdx ) const;
67 /** Returns true, if the specified defined name is volatile. */
68 bool IsVolatile( sal_uInt16 nNameIdx ) const;
70 /** Writes the entire list of NAME records. */
71 virtual void Save( XclExpStream& rStrm );
72 virtual void SaveXml( XclExpXmlStream& rStrm );
74 private:
75 typedef boost::shared_ptr< XclExpNameManagerImpl > XclExpNameMgrImplRef;
76 XclExpNameMgrImplRef mxImpl;
79 // ============================================================================
81 #endif
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */