LibreOffice Module sc (master) 1
xicontent.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 <rangelst.hxx>
23#include "xistring.hxx"
24#include "xiroot.hxx"
25#include <validat.hxx>
26#include <tabprotection.hxx>
27
28#include <map>
29#include <vector>
30#include <memory>
31
32class ErrCode;
33struct XclRange;
34
35/* ============================================================================
36Classes to import the big Excel document contents (related to several cells or
37globals for the document).
38- Shared
39 tables
40- Hyperlinks
41- Label ranges
42- Conditional formatting
43- Data validation
44- Web queries
45- Stream decryption
46============================================================================ */
47
48// Shared string table ========================================================
49
55class XclImpSst : protected XclImpRoot
56{
57public:
58 explicit XclImpSst( const XclImpRoot& rRoot );
59
62 void ReadSst( XclImpStream& rStrm );
63
65 const XclImpString* GetString( sal_uInt32 nSstIndex ) const;
66
67private:
68 typedef ::std::vector< XclImpString > XclImpStringVec;
70};
71
72// Hyperlinks =================================================================
73
76{
77public:
81 const XclImpHyperlink& operator=(const XclImpHyperlink&) = delete;
84 XclImpHyperlink() = delete;
85
88 static void ReadHlink( XclImpStream& rStrm );
89
91 static OUString ReadEmbeddedData( XclImpStream& rStrm );
92
94 static void InsertUrl( XclImpRoot& rRoot, const XclRange& rXclRange, const OUString& rUrl );
95
98 static void ConvertToValidTabName(OUString& rName);
99};
100
101// Label ranges ===============================================================
102
105{
106public:
116 static void ReadLabelranges( XclImpStream& rStrm );
117};
118
119// Conditional formatting =====================================================
120
123{
124public:
125 explicit XclImpCondFormat( const XclImpRoot& rRoot, sal_uInt32 nFormatIndex );
126 virtual ~XclImpCondFormat() override;
127
131 void ReadCF( XclImpStream& rStrm );
132
134 void Apply();
135
136private:
137 typedef ::std::unique_ptr< ScConditionalFormat > ScCondFmtPtr;
138
141 sal_uInt32 mnFormatIndex;
142 sal_uInt16 mnCondCount;
143 sal_uInt16 mnCondIndex;
144};
145
148{
149public:
150 explicit XclImpCondFormatManager( const XclImpRoot& rRoot );
151
155 void ReadCF( XclImpStream& rStrm );
156
158 void Apply();
159
160private:
161 std::vector< std::unique_ptr<XclImpCondFormat> >
163};
164
165// Data Validation ============================================================
166
169{
170public:
171 explicit XclImpValidationManager( const XclImpRoot& rRoot );
172
174 static void ReadDval( XclImpStream& rStrm );
176 void ReadDV( XclImpStream& rStrm );
177
178 void Apply();
179private:
180 struct DVItem
181 {
184
185 explicit DVItem ( ScRangeList aRanges, const ScValidationData& rValidData );
186 };
187
188 std::vector< std::unique_ptr<DVItem> > maDVItems;
189};
190
191// Web queries ================================================================
192
195{
196public:
197 explicit XclImpWebQuery( const ScRange& rDestRange );
198
207
209 void Apply( ScDocument& rDoc, const OUString& rFilterName );
210
211private:
214 {
219 };
220
221 OUString maURL;
222 OUString maTables;
225 sal_uInt16 mnRefresh;
226};
227
229{
230public:
231 explicit XclImpWebQueryBuffer( const XclImpRoot& rRoot );
232
234 void ReadQsi( XclImpStream& rStrm );
243
245 void Apply();
246
247private:
248 typedef std::vector< XclImpWebQuery > XclImpWebQueryList;
250};
251
252// Decryption =================================================================
253
256{
257public:
265
268 static const ErrCode& ReadFilepass( XclImpStream& rStrm );
269};
270
271// Document protection ========================================================
272
274{
275public:
276 explicit XclImpDocProtectBuffer( const XclImpRoot& rRoot );
277
280
283
285
286 void Apply() const;
287
288private:
289 sal_uInt16 mnPassHash;
292};
293
294// Sheet protection ===========================================================
295
297{
298public:
299 explicit XclImpSheetProtectBuffer( const XclImpRoot& rRoot );
300
301 void ReadProtect( XclImpStream& rStrm, SCTAB nTab );
302
303 void ReadOptions( XclImpStream& rStrm, SCTAB nTab );
304
305 void AppendEnhancedProtection( const ScEnhancedProtection & rProt, SCTAB nTab );
306
308
309 void Apply() const;
310
311private:
312 struct Sheet
313 {
315 sal_uInt16 mnPasswordHash;
316 sal_uInt16 mnOptions;
317 ::std::vector< ScEnhancedProtection > maEnhancedProtections;
318
319 Sheet();
320 Sheet(const Sheet& r);
321 };
322
323 Sheet* GetSheetItem( SCTAB nTab );
324
325private:
326 typedef ::std::map<SCTAB, Sheet> ProtectedSheetMap;
328};
329
330/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Imports and collects all conditional formatting of a sheet.
Definition: xicontent.hxx:148
std::vector< std::unique_ptr< XclImpCondFormat > > maCondFmtList
Definition: xicontent.hxx:162
void Apply()
Inserts the conditional formatting into the document.
Definition: xicontent.cxx:733
void ReadCondfmt(XclImpStream &rStrm)
Reads a CONDFMT record and starts a new conditional format to be filled from CF records.
Definition: xicontent.cxx:719
void ReadCF(XclImpStream &rStrm)
Reads a CF record and inserts the formatting data to the current conditional format.
Definition: xicontent.cxx:726
XclImpCondFormatManager(const XclImpRoot &rRoot)
Definition: xicontent.cxx:714
Represents a conditional format with condition formulas, and formatting attributes.
Definition: xicontent.hxx:123
sal_uInt32 mnFormatIndex
Calc conditional format.
Definition: xicontent.hxx:141
XclImpCondFormat(const XclImpRoot &rRoot, sal_uInt32 nFormatIndex)
Definition: xicontent.cxx:501
sal_uInt16 mnCondIndex
Number of conditions to be inserted.
Definition: xicontent.hxx:143
virtual ~XclImpCondFormat() override
Definition: xicontent.cxx:509
sal_uInt16 mnCondCount
Index of this conditional format in list.
Definition: xicontent.hxx:142
void ReadCondfmt(XclImpStream &rStrm)
Reads a CONDFMT record and initializes this conditional format.
Definition: xicontent.cxx:513
::std::unique_ptr< ScConditionalFormat > ScCondFmtPtr
Definition: xicontent.hxx:137
ScRangeList maRanges
Definition: xicontent.hxx:139
void Apply()
Inserts this conditional format into the document.
Definition: xicontent.cxx:701
ScCondFmtPtr mxScCondFmt
Destination cell ranges.
Definition: xicontent.hxx:140
void ReadCF(XclImpStream &rStrm)
Reads a CF record and adds a new condition and the formatting attributes.
Definition: xicontent.cxx:523
Provides static functions to import stream decryption settings.
Definition: xicontent.hxx:256
XclImpDecryptHelper()=delete
We don't want anybody to instantiate this class, since it is just a collection of static methods.
XclImpDecryptHelper(const XclImpDecryptHelper &)=delete
delete copy constructor
const XclImpDecryptHelper & operator=(const XclImpDecryptHelper &)=delete
delete copy-assignment operator
static const ErrCode & ReadFilepass(XclImpStream &rStrm)
Reads the FILEPASS record, queries a password and sets decryption algorithm.
Definition: xicontent.cxx:1248
XclImpDocProtectBuffer(const XclImpRoot &rRoot)
Definition: xicontent.cxx:1277
void ReadPasswordHash(XclImpStream &rStrm)
Definition: xicontent.cxx:1295
void ReadDocProtect(XclImpStream &rStrm)
document structure protection flag
Definition: xicontent.cxx:1285
void ReadWinProtect(XclImpStream &rStrm)
document windows properties protection flag
Definition: xicontent.cxx:1290
Provides importing label ranges and inserting them into a document.
Definition: xicontent.hxx:105
static void ReadLabelranges(XclImpStream &rStrm)
Reads a LABELRANGES record and inserts the label ranges into the document.
Definition: xicontent.cxx:442
const XclImpLabelranges & operator=(const XclImpLabelranges &)=delete
delete copy-assignment operator
XclImpLabelranges(const XclImpLabelranges &)=delete
delete copy constructor
XclImpLabelranges()=delete
We don't want anybody to instantiate this class, since it is just a collection of static methods.
Access to global data from other classes.
Definition: xiroot.hxx:129
XclImpSheetProtectBuffer(const XclImpRoot &rRoot)
Definition: xicontent.cxx:1341
void ReadOptions(XclImpStream &rStrm, SCTAB nTab)
Definition: xicontent.cxx:1356
void ReadProtect(XclImpStream &rStrm, SCTAB nTab)
Definition: xicontent.cxx:1346
Sheet * GetSheetItem(SCTAB nTab)
Definition: xicontent.cxx:1435
void AppendEnhancedProtection(const ScEnhancedProtection &rProt, SCTAB nTab)
Definition: xicontent.cxx:1375
ProtectedSheetMap maProtectedSheets
Definition: xicontent.hxx:327
::std::map< SCTAB, Sheet > ProtectedSheetMap
Definition: xicontent.hxx:326
void ReadPasswordHash(XclImpStream &rStrm, SCTAB nTab)
Definition: xicontent.cxx:1382
The SST (shared string table) contains all strings used in a BIFF8 file.
Definition: xicontent.hxx:56
XclImpSst(const XclImpRoot &rRoot)
Definition: xicontent.cxx:69
const XclImpString * GetString(sal_uInt32 nSstIndex) const
Returns a pointer to the string with the passed index.
Definition: xicontent.cxx:95
::std::vector< XclImpString > XclImpStringVec
Definition: xicontent.hxx:68
XclImpStringVec maStrings
Definition: xicontent.hxx:69
void ReadSst(XclImpStream &rStrm)
Reads the entire SST record.
Definition: xicontent.cxx:74
This class is used to import record oriented streams.
Definition: xistream.hxx:278
This class represents an unformatted or formatted string and provides importing from stream.
Definition: xistring.hxx:31
Imports validation data.
Definition: xicontent.hxx:169
std::vector< std::unique_ptr< DVItem > > maDVItems
Definition: xicontent.hxx:188
XclImpValidationManager(const XclImpRoot &rRoot)
Definition: xicontent.cxx:745
static void ReadDval(XclImpStream &rStrm)
Reads a DVAL record and sets marks the dropdown arrow control to be ignored.
Definition: xicontent.cxx:750
void ReadDV(XclImpStream &rStrm)
Reads a DV record and inserts validation data into the document.
Definition: xicontent.cxx:765
void ReadWqsettings(XclImpStream &rStrm)
Reads a WEBQRYSETTINGS record and sets refresh rate to the current web query.
Definition: xicontent.cxx:1088
std::vector< XclImpWebQuery > XclImpWebQueryList
Definition: xicontent.hxx:248
void Apply()
Inserts all web queries into the document.
Definition: xicontent.cxx:1100
void ReadWqtables(XclImpStream &rStrm)
Reads a WEBQRYTABLES record and sets source range list to the current web query.
Definition: xicontent.cxx:1094
void ReadWqstring(XclImpStream &rStrm)
Reads a WQSTRING record and sets URL to the current web query.
Definition: xicontent.cxx:1082
void ReadQsi(XclImpStream &rStrm)
Reads the QSI record and creates a new web query in the buffer.
Definition: xicontent.cxx:1049
XclImpWebQueryList maWQList
Definition: xicontent.hxx:249
void ReadParamqry(XclImpStream &rStrm)
Reads a PARAMQRY record and sets data to the current web query.
Definition: xicontent.cxx:1076
XclImpWebQueryBuffer(const XclImpRoot &rRoot)
Definition: xicontent.cxx:1044
Stores the data of one web query.
Definition: xicontent.hxx:195
void ReadWqtables(XclImpStream &rStrm)
Reads a WEBQRYTABLES record and sets source range list.
Definition: xicontent.cxx:1007
XclImpWebQueryMode
Specifies the type of the web query (which ranges are imported).
Definition: xicontent.hxx:214
@ xlWQAllTables
Entire document.
Definition: xicontent.hxx:217
@ xlWQDocument
Not specified.
Definition: xicontent.hxx:216
@ xlWQSpecTables
All tables.
Definition: xicontent.hxx:218
XclImpWebQueryMode meMode
Destination range.
Definition: xicontent.hxx:224
void ReadWqsettings(XclImpStream &rStrm)
Reads a WEBQRYSETTINGS record and sets refresh rate.
Definition: xicontent.cxx:996
OUString maTables
Source document URL.
Definition: xicontent.hxx:222
sal_uInt16 mnRefresh
Current mode of the web query.
Definition: xicontent.hxx:225
XclImpWebQuery(const ScRange &rDestRange)
Definition: xicontent.cxx:965
void ReadWqstring(XclImpStream &rStrm)
Reads a WQSTRING record and sets URL.
Definition: xicontent.cxx:991
void ReadParamqry(XclImpStream &rStrm)
Reads a PARAMQRY record and sets data to the web query.
Definition: xicontent.cxx:972
void Apply(ScDocument &rDoc, const OUString &rFilterName)
Inserts the web query into the document.
Definition: xicontent.cxx:1033
OUString maURL
Definition: xicontent.hxx:221
ScRange maDestRange
List of source range names.
Definition: xicontent.hxx:223
void SvStream & rStrm
Container for the Excel EnhancedProtection feature.
::std::vector< ScEnhancedProtection > maEnhancedProtections
Definition: xicontent.hxx:317
DVItem(ScRangeList aRanges, const ScValidationData &rValidData)
Definition: xicontent.cxx:742
A 2D cell range address struct with Excel column and row indexes.
Definition: xladdress.hxx:59
sal_Int16 SCTAB
Definition: types.hxx:22