LibreOffice Module sc (master)  1
xiname.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_XINAME_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_XINAME_HXX
22 
23 #include "xiroot.hxx"
24 #include "xistream.hxx"
25 
26 #include <rangenam.hxx>
27 
28 #include <memory>
29 #include <vector>
30 
31 class ScTokenArray;
32 
34 class XclImpName : protected XclImpRoot
35 {
37  {
40  std::size_t mnStrmPos;
41  std::size_t mnStrmSize;
42 
43  TokenStrmData( XclImpStream& rStrm );
44  };
45 
46 public:
47  XclImpName(const XclImpName&) = delete;
48  const XclImpName& operator=(const XclImpName&) = delete;
49 
50  explicit XclImpName( XclImpStream& rStrm, sal_uInt16 nXclNameIdx );
51 
52  const OUString& GetXclName() const { return maXclName; }
53  const OUString& GetScName() const { return maScName; }
54  SCTAB GetScTab() const { return mnScTab; }
55  const ScRangeData* GetScRangeData() const { return mpScData; }
56  bool IsGlobal() const { return mnScTab == SCTAB_MAX; }
57  bool IsVBName() const { return mbVBName; }
58  bool IsMacro() const { return mbMacro; }
59  void ConvertTokens();
60 
61 private:
62  void InsertName(const ScTokenArray* pArray);
63 
64  OUString maXclName;
65  OUString maScName;
69  sal_uInt16 mnXclTab;
70  sal_uInt16 mnNameIndex;
71  bool mbVBName:1;
72  bool mbMacro:1;
73 
74  std::unique_ptr<TokenStrmData> mpTokensData;
75 };
76 
82 class XclImpNameManager : protected XclImpRoot
83 {
84 public:
85  explicit XclImpNameManager( const XclImpRoot& rRoot );
86 
88  void ReadName( XclImpStream& rStrm );
89 
94  const XclImpName* FindName( const OUString& rXclName, SCTAB nScTab ) const;
95 
99  const XclImpName* GetName( sal_uInt16 nXclNameIdx ) const;
100 
101  void ConvertAllTokens();
102 
103 private:
104  typedef std::vector< std::unique_ptr<XclImpName> > XclImpNameList;
105  XclImpNameList maNameList;
106 };
107 
108 #endif
109 
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
sal_uInt16 mnNameIndex
Definition: xiname.hxx:70
XclImpNameManager(const XclImpRoot &rRoot)
Definition: xiname.cxx:278
void InsertName(const ScTokenArray *pArray)
Definition: xiname.cxx:236
void ConvertAllTokens()
Definition: xiname.cxx:316
void ReadName(XclImpStream &rStrm)
Reads a NAME record and creates an entry in this buffer.
Definition: xiname.cxx:283
const ScRangeData * mpScData
Name inserted into the Calc document.
Definition: xiname.hxx:66
This buffer contains all internal defined names of the document.
Definition: xiname.hxx:82
const OUString & GetScName() const
Definition: xiname.hxx:53
bool IsVBName() const
Definition: xiname.hxx:57
TokenStrmData(XclImpStream &rStrm)
Definition: xiname.cxx:31
bool IsMacro() const
Definition: xiname.hxx:58
const XclImpName * GetName(sal_uInt16 nXclNameIdx) const
Returns the defined name specified by its Excel index.
Definition: xiname.cxx:310
bool mbVBName
Definition: xiname.hxx:71
SCTAB GetScTab() const
Definition: xiname.hxx:54
std::size_t mnStrmPos
Definition: xiname.hxx:40
OUString maScName
Original name read from the file.
Definition: xiname.hxx:65
XclImpStream & mrStrm
Definition: xiname.hxx:38
const XclImpName & operator=(const XclImpName &)=delete
ScRangeData::Type meNameType
Calc sheet index of local names.
Definition: xiname.hxx:68
std::vector< std::unique_ptr< XclImpName > > XclImpNameList
Definition: xiname.hxx:104
const OUString & GetXclName() const
Definition: xiname.hxx:52
OUString maXclName
Definition: xiname.hxx:64
std::unique_ptr< TokenStrmData > mpTokensData
Whether it's a user-defined macro.
Definition: xiname.hxx:74
XclImpStreamPos maStrmPos
Definition: xiname.hxx:39
const XclImpName * FindName(const OUString &rXclName, SCTAB nScTab) const
Tries to find the name used in Calc, based on the original Excel defined name.
Definition: xiname.cxx:290
SCTAB mnScTab
Pointer to Calc defined name (no ownership).
Definition: xiname.hxx:67
This class represents an Excel stream position.
Definition: xistream.hxx:202
bool IsGlobal() const
Definition: xiname.hxx:56
bool mbMacro
true = Visual Basic procedure or function.
Definition: xiname.hxx:72
void ConvertTokens()
Definition: xiname.cxx:214
std::size_t mnStrmSize
Definition: xiname.hxx:41
This class is used to import record oriented streams.
Definition: xistream.hxx:278
XclImpName(const XclImpName &)=delete
const ScRangeData * GetScRangeData() const
Definition: xiname.hxx:55
void SvStream & rStrm
const SCTAB SCTAB_MAX
Definition: address.hxx:58
Access to global data from other classes.
Definition: xiroot.hxx:126
sal_uInt16 mnXclTab
Definition: xiname.hxx:69
Represents a defined name.
Definition: xiname.hxx:34
XclImpNameList maNameList
Definition: xiname.hxx:105
sal_Int16 SCTAB
Definition: types.hxx:23