LibreOffice Module sc (master) 1
excform.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 "xlformula.hxx"
23#include "xiroot.hxx"
24#include "xltools.hxx"
25#include "formel.hxx"
26
27#include <vector>
28
29class ScFormulaCell;
30class ScRangeList;
31
32class ExcelToSc : public ExcelConverterBase, protected XclImpRoot
33{
34protected:
36 typedef ::std::vector< ExtensionType > ExtensionTypeVec;
37
38 static const sal_uInt16 nRowMask;
39
42
43 void DoMulArgs( DefTokenId eId, sal_uInt8 nNumArgs );
44
45 void ExcRelToScRel( sal_uInt16 nRow, sal_uInt8 nCol, ScSingleRefData&, const bool bName );
46
47public:
48 ExcelToSc( XclImpRoot& rRoot );
49 virtual ~ExcelToSc() override;
50 virtual ConvErr Convert( std::unique_ptr<ScTokenArray>&, XclImpStream& rStrm, std::size_t nFormulaLen,
51 bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ) override;
52
53 virtual ConvErr Convert( ScRangeListTabs&, XclImpStream& rStrm, std::size_t nFormulaLen, SCTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula ) override;
54
55 virtual void ConvertExternName( std::unique_ptr<ScTokenArray>& rpArray, XclImpStream& rStrm, std::size_t nFormulaLen,
56 const OUString& rUrl, const ::std::vector<OUString>& rTabNames );
57
58 virtual void GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, std::size_t nLen );
59
60 std::unique_ptr<ScTokenArray> GetDummy();
61 std::unique_ptr<ScTokenArray> GetBoolErr( XclBoolError );
62
63 static bool ReadSharedFormulaPosition( XclImpStream& rStrm, SCCOL& rCol, SCROW& rRow );
64 const ScTokenArray* GetSharedFormula( const ScAddress& rRefPos ) const;
65
66 static void SetError( ScFormulaCell& rCell, const ConvErr eErr );
67
68 static inline bool IsComplColRange( const sal_uInt16 nCol1, const sal_uInt16 nCol2 );
69 static inline bool IsComplRowRange( const sal_uInt16 nRow1, const sal_uInt16 nRow2 );
70
73
74 void ReadExtensions( const ExtensionTypeVec& rExtensions,
75 XclImpStream& aIn );
76 void ReadExtensionArray( unsigned int n,
77 XclImpStream& aIn );
78 static void ReadExtensionNlr( XclImpStream& aIn );
80};
81
82inline bool ExcelToSc::IsComplColRange( const sal_uInt16 nCol1, const sal_uInt16 nCol2 )
83{
84 return ( nCol1 == 0x00 ) && ( nCol2 == 0xFF );
85}
86
87inline bool ExcelToSc::IsComplRowRange( const sal_uInt16 nRow1, const sal_uInt16 nRow2 )
88{
89 return ( ( nRow1 & 0x3FFF ) == 0x0000 ) && ( ( nRow2 & 0x3FFF ) == 0x3FFF );
90}
91
93class XclImpExtName;
94
95class ExcelToSc8 : public ExcelToSc
96{
97public:
98
100 {
102 OUString maTabName;
103 sal_uInt16 mnFileId;
105
107 };
108
109private:
111
112 void ExcRelToScRel8( sal_uInt16 nRow, sal_uInt16 nCol, ScSingleRefData&,
113 const bool bName );
114
115 bool GetExternalFileIdFromXti( sal_uInt16 nIxti, sal_uInt16& rFileId ) const;
116
117 virtual bool Read3DTabReference( sal_uInt16 nIxti, SCTAB& rFirstTab, SCTAB& rLastTab, ExternalTabInfo& rExtInfo );
118
119 bool HandleOleLink(sal_uInt16 nXtiIndex, const XclImpExtName& rExtName, ExternalTabInfo& rExtInfo);
120public:
121 ExcelToSc8( XclImpRoot& rRoot );
122 virtual ~ExcelToSc8() override;
123
124 virtual ConvErr Convert( std::unique_ptr<ScTokenArray>& rpTokArray, XclImpStream& rStrm, std::size_t nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT = FT_CellFormula ) override;
125
126 virtual ConvErr Convert( ScRangeListTabs&, XclImpStream& rStrm, std::size_t nFormulaLen, SCTAB nTab, const FORMULA_TYPE eFT = FT_CellFormula ) override;
127
128 virtual void ConvertExternName( std::unique_ptr<ScTokenArray>& rpArray, XclImpStream& rStrm, std::size_t nFormulaLen,
129 const OUString& rUrl, const ::std::vector<OUString>& rTabNames ) override;
130
131 static inline bool IsComplRowRange( const sal_uInt16 nRow1, const sal_uInt16 nRow2 );
132
133 virtual void GetAbsRefs( ScRangeList& rRangeList, XclImpStream& rStrm, std::size_t nLen ) override;
134};
135
136inline bool ExcelToSc8::IsComplRowRange( const sal_uInt16 nRow1, const sal_uInt16 nRow2 )
137{
138 return ( nRow1 == 0x0000 ) && ( nRow2 == 0xFFFF );
139}
140
141/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void ConvertExternName(std::unique_ptr< ScTokenArray > &rpArray, XclImpStream &rStrm, std::size_t nFormulaLen, const OUString &rUrl, const ::std::vector< OUString > &rTabNames) override
Definition: excform8.cxx:1286
void ExcRelToScRel8(sal_uInt16 nRow, sal_uInt16 nCol, ScSingleRefData &, const bool bName)
Definition: excform8.cxx:1436
virtual void GetAbsRefs(ScRangeList &rRangeList, XclImpStream &rStrm, std::size_t nLen) override
Definition: excform8.cxx:1491
virtual ConvErr Convert(std::unique_ptr< ScTokenArray > &rpTokArray, XclImpStream &rStrm, std::size_t nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT=FT_CellFormula) override
Definition: excform8.cxx:138
bool HandleOleLink(sal_uInt16 nXtiIndex, const XclImpExtName &rExtName, ExternalTabInfo &rExtInfo)
Definition: excform8.cxx:121
const XclImpLinkManager & rLinkMan
Definition: excform.hxx:110
virtual ~ExcelToSc8() override
Definition: excform8.cxx:88
ExcelToSc8(XclImpRoot &rRoot)
Definition: excform8.cxx:82
static bool IsComplRowRange(const sal_uInt16 nRow1, const sal_uInt16 nRow2)
Definition: excform.hxx:136
bool GetExternalFileIdFromXti(sal_uInt16 nIxti, sal_uInt16 &rFileId) const
Definition: excform8.cxx:92
virtual bool Read3DTabReference(sal_uInt16 nIxti, SCTAB &rFirstTab, SCTAB &rLastTab, ExternalTabInfo &rExtInfo)
Definition: excform8.cxx:105
void ExcRelToScRel(sal_uInt16 nRow, sal_uInt8 nCol, ScSingleRefData &, const bool bName)
Definition: excform.cxx:1607
void ReadExtensions(const ExtensionTypeVec &rExtensions, XclImpStream &aIn)
Definition: excform.cxx:1887
void ReadExtensionArray(unsigned int n, XclImpStream &aIn)
Definition: excform.cxx:1760
static bool IsComplRowRange(const sal_uInt16 nRow1, const sal_uInt16 nRow2)
Definition: excform.hxx:87
std::unique_ptr< ScTokenArray > GetDummy()
Definition: excform.cxx:191
@ EXTENSION_MEMAREA
Definition: excform.hxx:35
@ EXTENSION_NLR
Definition: excform.hxx:35
@ EXTENSION_ARRAY
Definition: excform.hxx:35
static bool ReadSharedFormulaPosition(XclImpStream &rStrm, SCCOL &rCol, SCROW &rRow)
Definition: excform.cxx:1699
const XclBiff meBiff
Definition: excform.hxx:41
virtual ~ExcelToSc() override
Definition: excform.cxx:187
static void SetError(ScFormulaCell &rCell, const ConvErr eErr)
Definition: excform.cxx:1726
virtual void GetAbsRefs(ScRangeList &rRangeList, XclImpStream &rStrm, std::size_t nLen)
Definition: excform.cxx:1312
::std::vector< ExtensionType > ExtensionTypeVec
Definition: excform.hxx:36
XclFunctionProvider maFuncProv
Definition: excform.hxx:40
void DoMulArgs(DefTokenId eId, sal_uInt8 nNumArgs)
Definition: excform.cxx:1527
void SetComplCol(ScComplexRefData &)
Definition: excform.cxx:1740
static bool IsComplColRange(const sal_uInt16 nCol1, const sal_uInt16 nCol2)
Definition: excform.hxx:82
virtual ConvErr Convert(std::unique_ptr< ScTokenArray > &, XclImpStream &rStrm, std::size_t nFormulaLen, bool bAllowArrays, const FORMULA_TYPE eFT=FT_CellFormula) override
Definition: excform.cxx:201
std::unique_ptr< ScTokenArray > GetBoolErr(XclBoolError)
Definition: excform.cxx:1658
ExcelToSc(XclImpRoot &rRoot)
Definition: excform.cxx:179
void ReadExtensionMemArea(XclImpStream &aIn)
Definition: excform.cxx:1880
const ScTokenArray * GetSharedFormula(const ScAddress &rRefPos) const
Definition: excform.cxx:1721
virtual void ConvertExternName(std::unique_ptr< ScTokenArray > &rpArray, XclImpStream &rStrm, std::size_t nFormulaLen, const OUString &rUrl, const ::std::vector< OUString > &rTabNames)
Definition: excform.cxx:1307
void SetComplRow(ScComplexRefData &)
Definition: excform.cxx:1750
static void ReadExtensionNlr(XclImpStream &aIn)
Definition: excform.cxx:1871
static const sal_uInt16 nRowMask
Definition: excform.hxx:38
Provides access to function info structs for all available functions.
Definition: xlformula.hxx:345
Stores contents of an external name.
Definition: xilink.hxx:113
This is the central class for the import of all internal/external links.
Definition: xilink.hxx:185
Access to global data from other classes.
Definition: xiroot.hxx:129
This class is used to import record oriented streams.
Definition: xistream.hxx:278
ConvErr
Definition: formel.hxx:41
FORMULA_TYPE
Definition: formel.hxx:48
@ FT_CellFormula
Definition: formel.hxx:49
OpCode
Complex reference (a range) into the sheet.
Definition: refdata.hxx:123
Single reference (one address) into the sheet.
Definition: refdata.hxx:30
unsigned char sal_uInt8
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21
sal_Int32 SCROW
Definition: types.hxx:17
XclBiff
An enumeration for all Excel file format types (BIFF types).
Definition: xlconst.hxx:30
XclBoolError
An enumeration for all Excel error codes and the values true and false.
Definition: xltools.hxx:40