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