LibreOffice Module sc (master) 1
xecontent.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 <memory>
23#include <rangelst.hxx>
24#include "xladdress.hxx"
25#include "xerecord.hxx"
26#include "xeroot.hxx"
27#include "xestring.hxx"
28#include "xeextlst.hxx"
29#include "xlformula.hxx"
30
31#include <colorscale.hxx>
32
33/* ============================================================================
34Classes to export the big Excel document contents (related to several cells or
35globals for the sheet or document).
36- Shared string table
37- Merged cells
38- Hyperlinks
39- Label ranges
40- Conditional formatting
41- Data validation
42- Web Queries
43============================================================================ */
44
45// Shared string table ========================================================
46
47class XclExpSstImpl;
48
52{
53public:
54 explicit XclExpSst();
55 virtual ~XclExpSst() override;
56
59 sal_uInt32 Insert( const XclExpStringRef& xString );
60
62 virtual void Save( XclExpStream& rStrm ) override;
63 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
64
65private:
66 typedef std::unique_ptr< XclExpSstImpl > XclExpSstImplPtr;
68};
69
70// Merged cells ===============================================================
71
74{
75public:
76 explicit XclExpMergedcells( const XclExpRoot& rRoot );
77
79 void AppendRange( const ScRange& rRange, sal_uInt32 nBaseXFId );
81 sal_uInt32 GetBaseXFId( const ScAddress& rPos ) const;
82
84 virtual void Save( XclExpStream& rStrm ) override;
85 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
86
87private:
90};
91
92// Hyperlinks =================================================================
93
94class SvxURLField;
95
98{
99public:
101 explicit XclExpHyperlink( const XclExpRoot& rRoot,
102 const SvxURLField& rUrlField, const ScAddress& rScPos );
103 virtual ~XclExpHyperlink() override;
104
106 const OUString* GetRepr() const { return m_Repr.isEmpty() ? nullptr : &m_Repr; }
107
108 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
109
110 void WriteEmbeddedData( XclExpStream& rStrm );
111
116 static OUString BuildFileName(
117 sal_uInt16& rnLevel, bool& rbRel,
118 const OUString& rUrl, const XclExpRoot& rRoot, bool bEncoded );
119private:
120
122 virtual void WriteBody( XclExpStream& rStrm ) override;
123
124private:
125 typedef std::unique_ptr< SvStream > SvStreamPtr;
126
128 OUString m_Repr;
130 sal_uInt32 mnFlags;
132 OUString msTarget;
133};
134
136
137// Label ranges ===============================================================
138
141{
142public:
144 explicit XclExpLabelranges( const XclExpRoot& rRoot );
145
147 virtual void Save( XclExpStream& rStrm ) override;
148
149private:
154 static void FillRangeList( ScRangeList& rScRanges,
155 const ScRangePairListRef& xLabelRangesRef, SCTAB nScTab );
156
157private:
160};
161
162// Conditional formatting =====================================================
163
164class XclExpCFImpl;
165
167class XclExpCF : public XclExpRecord, protected XclExpRoot
168{
169public:
170 explicit XclExpCF( const XclExpRoot& rRoot, const ScCondFormatEntry& rFormatEntry, sal_Int32 nPriority, ScAddress aOrigin );
171 virtual ~XclExpCF() override;
172
173 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
174
175private:
177 virtual void WriteBody( XclExpStream& rStrm ) override;
178
179private:
180 typedef std::unique_ptr< XclExpCFImpl > XclExpCFImplPtr;
182};
183
184class XclExpDateFormat : public XclExpRecord, protected XclExpRoot
185{
186public:
187 explicit XclExpDateFormat( const XclExpRoot& rRoot, const ScCondDateFormatEntry& rFormatEntry, sal_Int32 nPriority );
188 virtual ~XclExpDateFormat() override;
189
190 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
191
192private:
194 sal_Int32 mnPriority;
195};
196
197class XclExpCfvo : public XclExpRecord, protected XclExpRoot
198{
199public:
200 explicit XclExpCfvo( const XclExpRoot& rRoot, const ScColorScaleEntry& rFormatEntry, const ScAddress& rPos, bool bFirst = true);
201
202 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
203private:
207};
208
210{
211public:
212 explicit XclExpColScaleCol( const XclExpRoot& rRoot, const Color& rColor);
213 virtual ~XclExpColScaleCol() override;
214
215 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
216private:
218};
219
222class XclExpCondfmt : public XclExpRecord, protected XclExpRoot
223{
224public:
225 explicit XclExpCondfmt( const XclExpRoot& rRoot, const ScConditionalFormat& rCondFormat, const XclExtLstRef& xExtLst, sal_Int32& rIndex );
226 virtual ~XclExpCondfmt() override;
227
229 bool IsValidForBinary() const;
230 bool IsValidForXml() const;
231
233 virtual void Save( XclExpStream& rStrm ) override;
234 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
235
236private:
238 virtual void WriteBody( XclExpStream& rStrm ) override;
239
240private:
244 OUString msSeqRef;
245};
246
248{
249public:
250 explicit XclExpColorScale( const XclExpRoot& rRoot, const ScColorScaleFormat& rFormat, sal_Int32 nPriority );
251
252 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
253private:
256
259 sal_Int32 mnPriority;
260};
261
262class XclExpDataBar : public XclExpRecord, protected XclExpRoot
263{
264public:
265 explicit XclExpDataBar( const XclExpRoot& rRoot, const ScDataBarFormat& rFormat, sal_Int32 nPriority, OString aGUID);
266
267 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
268private:
269 std::unique_ptr<XclExpCfvo> mpCfvoLowerLimit;
270 std::unique_ptr<XclExpCfvo> mpCfvoUpperLimit;
271 std::unique_ptr<XclExpColScaleCol> mpCol;
272
274 sal_Int32 mnPriority;
275 OString maGUID;
276};
277
278class XclExpIconSet : public XclExpRecord, protected XclExpRoot
279{
280public:
281 explicit XclExpIconSet( const XclExpRoot& rRoot, const ScIconSetFormat& rFormat, sal_Int32 nPriority );
282
283 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
284private:
286
289 sal_Int32 mnPriority;
290};
291
294{
295public:
297 explicit XclExpCondFormatBuffer( const XclExpRoot& rRoot, const XclExtLstRef& xExtLst );
298
300 virtual void Save( XclExpStream& rStrm ) override;
301 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
302
303private:
306};
307
308// Data Validation ============================================================
309
314class XclExpDV : public XclExpRecord, protected XclExpRoot
315{
316public:
317 explicit XclExpDV( const XclExpRoot& rRoot, sal_uInt32 nScHandle );
318 virtual ~XclExpDV() override;
319
321 sal_uInt32 GetScHandle() const { return mnScHandle; }
322
324 void InsertCellRange( const ScRange& rPos );
327 bool Finalize();
328
329 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
330
331private:
333 virtual void WriteBody( XclExpStream& rStrm ) override;
334
335private:
344 OUString msFormula1;
345 OUString msList;
347 OUString msFormula2;
348 sal_uInt32 mnFlags;
349 sal_uInt32 mnScHandle;
350};
351
353class XclExpDval : public XclExpRecord, protected XclExpRoot
354{
355public:
356 explicit XclExpDval( const XclExpRoot& rRoot );
357 virtual ~XclExpDval() override;
358
360 void InsertCellRange( const ScRange& rRange, sal_uInt32 nScHandle );
361
363 virtual void Save( XclExpStream& rStrm ) override;
364 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
365
366private:
368 XclExpDV& SearchOrCreateDv( sal_uInt32 nScHandle );
369
371 virtual void WriteBody( XclExpStream& rStrm ) override;
372
373private:
376
379};
380
381// Web Queries ================================================================
382
388{
389public:
391 explicit XclExpWebQuery(
392 const OUString& rRangeName,
393 const OUString& rUrl,
394 std::u16string_view rSource,
395 sal_Int32 nRefrSecs );
396 virtual ~XclExpWebQuery() override;
397
399 virtual void Save( XclExpStream& rStrm ) override;
400
401private:
405 sal_Int16 mnRefresh;
407};
408
410class XclExpWebQueryBuffer : public XclExpRecordList< XclExpWebQuery >
411{
412public:
413 explicit XclExpWebQueryBuffer( const XclExpRoot& rRoot );
414};
415
416/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Represents a CF record that contains one condition of a conditional format.
Definition: xecontent.cxx:598
Represents a CF record that contains one condition of a conditional format.
Definition: xecontent.hxx:168
XclExpCFImplPtr mxImpl
Definition: xecontent.hxx:181
XclExpCF(const XclExpRoot &rRoot, const ScCondFormatEntry &rFormatEntry, sal_Int32 nPriority, ScAddress aOrigin)
Definition: xecontent.cxx:1101
std::unique_ptr< XclExpCFImpl > XclExpCFImplPtr
Definition: xecontent.hxx:180
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1117
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the CF record.
Definition: xecontent.cxx:1112
virtual ~XclExpCF() override
Definition: xecontent.cxx:1108
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1222
ScAddress maSrcPos
Definition: xecontent.hxx:205
const ScColorScaleEntry & mrEntry
Definition: xecontent.hxx:204
bool mbFirst
Definition: xecontent.hxx:206
XclExpCfvo(const XclExpRoot &rRoot, const ScColorScaleEntry &rFormatEntry, const ScAddress &rPos, bool bFirst=true)
Definition: xecontent.cxx:1184
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1255
const Color & mrColor
Definition: xecontent.hxx:217
XclExpColScaleCol(const XclExpRoot &rRoot, const Color &rColor)
Definition: xecontent.cxx:1245
virtual ~XclExpColScaleCol() override
Definition: xecontent.cxx:1251
XclExpRecordList< XclExpCfvo > XclExpCfvoList
Definition: xecontent.hxx:254
XclExpColorScale(const XclExpRoot &rRoot, const ScColorScaleFormat &rFormat, sal_Int32 nPriority)
Definition: xecontent.cxx:1442
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1459
XclExpCfvoList maCfvoList
Definition: xecontent.hxx:257
XclExpRecordList< XclExpColScaleCol > XclExpColScaleColList
Definition: xecontent.hxx:255
XclExpColScaleColList maColList
Definition: xecontent.hxx:258
sal_Int32 mnPriority
Definition: xecontent.hxx:259
Contains all conditional formats of a specific sheet.
Definition: xecontent.hxx:294
XclExpRecordList< XclExpCondfmt > XclExpCondfmtList
Definition: xecontent.hxx:304
XclExpCondFormatBuffer(const XclExpRoot &rRoot, const XclExtLstRef &xExtLst)
Constructs CONDFMT and CF records containing the conditional formats of the current sheet.
Definition: xecontent.cxx:1565
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1585
virtual void Save(XclExpStream &rStrm) override
Writes all contained CONDFMT records with their CF records.
Definition: xecontent.cxx:1580
XclExpCondfmtList maCondfmtList
Definition: xecontent.hxx:305
Represents a CONDFMT record that contains all conditions of a conditional format.
Definition: xecontent.hxx:223
bool IsValidForBinary() const
Returns true, if this conditional format contains at least one cell range and CF record.
Definition: xecontent.cxx:1391
XclExpCondfmt(const XclExpRoot &rRoot, const ScConditionalFormat &rCondFormat, const XclExtLstRef &xExtLst, sal_Int32 &rIndex)
Definition: xecontent.cxx:1298
XclRangeList maXclRanges
List of CF records.
Definition: xecontent.hxx:243
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1426
virtual void Save(XclExpStream &rStrm) override
Writes the CONDFMT record with following CF records, if there is valid data.
Definition: xecontent.cxx:1406
bool IsValidForXml() const
Definition: xecontent.cxx:1401
XclExpRecordList< XclExpRecord > maCFList
Definition: xecontent.hxx:242
OUString msSeqRef
Cell ranges for this conditional format.
Definition: xecontent.hxx:244
virtual ~XclExpCondfmt() override
Definition: xecontent.cxx:1387
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the CONDFMT record.
Definition: xecontent.cxx:1415
Provides export of the data of a DV record.
Definition: xecontent.hxx:315
XclExpString maPromptText
The prompt title.
Definition: xecontent.hxx:339
sal_uInt32 mnFlags
OOXML Formula for second condition.
Definition: xecontent.hxx:348
void InsertCellRange(const ScRange &rPos)
Inserts a new cell range into the cell range list.
Definition: xecontent.cxx:1856
XclRangeList maXclRanges
Calc range list with all affected cells.
Definition: xecontent.hxx:337
XclExpString maErrorTitle
The prompt text.
Definition: xecontent.hxx:340
XclTokenArrayRef mxTokArr2
x12ac:list for first condition.
Definition: xecontent.hxx:346
ScRangeList maScRanges
Definition: xecontent.hxx:336
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the DV record.
Definition: xecontent.cxx:1867
XclExpStringRef mxString1
The error text.
Definition: xecontent.hxx:342
OUString msFormula1
Formula for first condition.
Definition: xecontent.hxx:344
XclExpDV(const XclExpRoot &rRoot, sal_uInt32 nScHandle)
Definition: xecontent.cxx:1676
OUString msFormula2
Formula for second condition.
Definition: xecontent.hxx:347
sal_uInt32 mnScHandle
Miscellaneous flags.
Definition: xecontent.hxx:349
sal_uInt32 GetScHandle() const
Returns the core handle of the validation data.
Definition: xecontent.hxx:321
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1881
bool Finalize()
Converts the Calc range list to the Excel range list.
Definition: xecontent.cxx:1861
XclExpString maPromptTitle
Excel range list with all affected cells.
Definition: xecontent.hxx:338
XclTokenArrayRef mxTokArr1
String for first condition formula.
Definition: xecontent.hxx:343
XclExpString maErrorText
The error title.
Definition: xecontent.hxx:341
OUString msList
OOXML Formula for first condition.
Definition: xecontent.hxx:345
virtual ~XclExpDV() override
Definition: xecontent.cxx:1852
std::unique_ptr< XclExpColScaleCol > mpCol
Definition: xecontent.hxx:271
XclExpDataBar(const XclExpRoot &rRoot, const ScDataBarFormat &rFormat, sal_Int32 nPriority, OString aGUID)
Definition: xecontent.cxx:1477
OString maGUID
Definition: xecontent.hxx:275
sal_Int32 mnPriority
Definition: xecontent.hxx:274
std::unique_ptr< XclExpCfvo > mpCfvoUpperLimit
Definition: xecontent.hxx:270
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1494
const ScDataBarFormat & mrFormat
Definition: xecontent.hxx:273
std::unique_ptr< XclExpCfvo > mpCfvoLowerLimit
Definition: xecontent.hxx:269
const ScCondDateFormatEntry & mrFormatEntry
Definition: xecontent.hxx:193
sal_Int32 mnPriority
Definition: xecontent.hxx:194
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1168
XclExpDateFormat(const XclExpRoot &rRoot, const ScCondDateFormatEntry &rFormatEntry, sal_Int32 nPriority)
Definition: xecontent.cxx:1122
virtual ~XclExpDateFormat() override
Definition: xecontent.cxx:1130
This class contains the DV record list following the DVAL record.
Definition: xecontent.hxx:354
void InsertCellRange(const ScRange &rRange, sal_uInt32 nScHandle)
Inserts the cell range into the range list of the DV record with the specified handle.
Definition: xecontent.cxx:1941
virtual void Save(XclExpStream &rStrm) override
Writes the DVAL record and the DV record list.
Definition: xecontent.cxx:1950
virtual ~XclExpDval() override
Definition: xecontent.cxx:1937
XclExpDVList maDVList
Definition: xecontent.hxx:377
XclExpDval(const XclExpRoot &rRoot)
Definition: xecontent.cxx:1931
XclExpDVRef mxLastFoundDV
List of DV records.
Definition: xecontent.hxx:378
XclExpDVList::RecordRefType XclExpDVRef
Definition: xecontent.hxx:375
XclExpRecordList< XclExpDV > XclExpDVList
Definition: xecontent.hxx:374
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1970
XclExpDV & SearchOrCreateDv(sal_uInt32 nScHandle)
Searches for or creates a XclExpDV record object with the specified handle.
Definition: xecontent.cxx:1986
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the DVAL record.
Definition: xecontent.cxx:2026
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:1545
XclExpIconSet(const XclExpRoot &rRoot, const ScIconSetFormat &rFormat, sal_Int32 nPriority)
Definition: xecontent.cxx:1529
const ScIconSetFormat & mrFormat
Definition: xecontent.hxx:288
sal_Int32 mnPriority
Definition: xecontent.hxx:289
XclExpCfvoList maCfvoList
Definition: xecontent.hxx:287
XclExpRecordList< XclExpCfvo > XclExpCfvoList
Definition: xecontent.hxx:285
Provides export of the row/column label range list of a sheet.
Definition: xecontent.hxx:141
XclExpLabelranges(const XclExpRoot &rRoot)
Fills the cell range lists with all ranges of the current sheet.
Definition: xecontent.cxx:551
static void FillRangeList(ScRangeList &rScRanges, const ScRangePairListRef &xLabelRangesRef, SCTAB nScTab)
Fills the specified range list with all label headers of the current sheet.
Definition: xecontent.cxx:568
ScRangeList maColRanges
Cell range list for row labels.
Definition: xecontent.hxx:159
ScRangeList maRowRanges
Definition: xecontent.hxx:158
virtual void Save(XclExpStream &rStrm) override
Writes the LABELRANGES record if it contains at least one range.
Definition: xecontent.cxx:580
Represents a MERGEDCELLS record containing all merged cell ranges in a sheet.
Definition: xecontent.hxx:74
virtual void Save(XclExpStream &rStrm) override
Writes the record, if it contains at least one merged cell range.
Definition: xecontent.cxx:291
void AppendRange(const ScRange &rRange, sal_uInt32 nBaseXFId)
Appends a new range to the list of merged cell ranges.
Definition: xecontent.cxx:268
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:311
ScfUInt32Vec maBaseXFIds
All merged cell ranges of the sheet.
Definition: xecontent.hxx:89
XclExpMergedcells(const XclExpRoot &rRoot)
Definition: xecontent.cxx:263
sal_uInt32 GetBaseXFId(const ScAddress &rPos) const
Returns the XF identifier of the top-left cell in a merged range.
Definition: xecontent.cxx:277
ScRangeList maMergedRanges
Definition: xecontent.hxx:88
Base class for all Excel records.
Definition: xerecord.hxx:39
A list of Excel record objects.
Definition: xerecord.hxx:322
Base class for single records with any content.
Definition: xerecord.hxx:143
Access to global data from other classes.
Definition: xeroot.hxx:113
Implementation of the SST export.
Definition: xecontent.cxx:95
Provides export of the SST (shared string table) record.
Definition: xecontent.hxx:52
virtual ~XclExpSst() override
Definition: xecontent.cxx:242
virtual void Save(XclExpStream &rStrm) override
Writes the complete SST and EXTSST records.
Definition: xecontent.cxx:251
std::unique_ptr< XclExpSstImpl > XclExpSstImplPtr
Definition: xecontent.hxx:66
sal_uInt32 Insert(const XclExpStringRef &xString)
Inserts a new string into the table.
Definition: xecontent.cxx:246
XclExpSstImplPtr mxImpl
Definition: xecontent.hxx:67
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: xecontent.cxx:256
This class is used to export Excel record streams.
Definition: xestream.hxx:73
This class stores an unformatted or formatted string for Excel export.
Definition: xestring.hxx:48
Contains all web query records for this document.
Definition: xecontent.hxx:411
XclExpWebQueryBuffer(const XclExpRoot &rRoot)
Definition: xecontent.cxx:2143
Contains all records for a web query (linked tables in an HTML document).
Definition: xecontent.hxx:388
virtual void Save(XclExpStream &rStrm) override
Writes all needed records for this web query.
Definition: xecontent.cxx:2076
XclExpStringRef mxQryTables
Source document URL.
Definition: xecontent.hxx:404
virtual ~XclExpWebQuery() override
Definition: xecontent.cxx:2072
bool mbEntireDoc
Refresh time in minutes.
Definition: xecontent.hxx:406
XclExpString maDestRange
Definition: xecontent.hxx:402
sal_Int16 mnRefresh
List of source range names.
Definition: xecontent.hxx:405
XclExpWebQuery(const OUString &rRangeName, const OUString &rUrl, std::u16string_view rSource, sal_Int32 nRefrSecs)
Constructs a web query record container with settings from Calc.
Definition: xecontent.cxx:2034
XclExpString maUrl
Destination range.
Definition: xecontent.hxx:403
A 2D cell range address list with Excel column and row indexes.
Definition: xladdress.hxx:102
::std::vector< sal_uInt32 > ScfUInt32Vec
Definition: ftools.hxx:257
void SvStream & rStrm
sal_Int16 SCTAB
Definition: types.hxx:22
XclExpRecordList< XclExpHyperlink > XclExpHyperlinkList
Definition: xecontent.hxx:135
std::shared_ptr< XclExpString > XclExpStringRef
Definition: xeroot.hxx:35
std::shared_ptr< XclTokenArray > XclTokenArrayRef
Definition: xlformula.hxx:416