LibreOffice Module sc (master) 1
excrecds.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 <rtl/string.hxx>
23#include <rtl/ustring.hxx>
24#include <tools/color.hxx>
25
26#include "xerecord.hxx"
27#include "xeroot.hxx"
28#include "excdefs.hxx"
29
30//------------------------------------------------------------------ Forwards -
31
32class ScDBData;
33struct ScQueryEntry;
34
35//----------------------------------------------------------- class ExcRecord -
36
37class ExcRecord : public XclExpRecord
38{
39public:
40 virtual void Save( XclExpStream& rStrm ) override;
41 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
42
43 virtual sal_uInt16 GetNum() const = 0;
44 virtual std::size_t GetLen() const = 0;
45
46protected:
47 virtual void SaveCont( XclExpStream& rStrm );
48
49private:
51 virtual void WriteBody( XclExpStream& rStrm ) override;
52};
53
54//--------------------------------------------------------- class ExcEmptyRec -
55
56class ExcEmptyRec : public ExcRecord
57{
58private:
59protected:
60public:
61 virtual void Save( XclExpStream& rStrm ) override;
62 virtual sal_uInt16 GetNum() const override;
63 virtual std::size_t GetLen() const override;
64};
65
66//--------------------------------------------------------- class ExcDummyRec -
67
68class ExcDummyRec : public ExcRecord
69{
70protected:
71public:
72 virtual void Save( XclExpStream& rStrm ) override;
73 virtual sal_uInt16 GetNum() const override;
74 virtual const sal_uInt8* GetData() const = 0; // byte data must contain header and body
75};
76
77//------------------------------------------------------- class ExcBoolRecord -
78// stores bool as 16bit val ( 0x0000 | 0x0001 )
79
81{
82private:
83 virtual void SaveCont( XclExpStream& rStrm ) override;
84
85protected:
86 bool bVal;
87
88 ExcBoolRecord() : bVal( false ) {}
89
90public:
91 virtual std::size_t GetLen() const override;
92};
93
94//--------------------------------------------------------- class ExcBof_Base -
95
96class ExcBof_Base : public ExcRecord
97{
98private:
99protected:
100 sal_uInt16 nDocType;
101 sal_uInt16 nVers;
102 sal_uInt16 nRupBuild;
103 sal_uInt16 nRupYear;
104public:
105 ExcBof_Base();
106};
107
108//-------------------------------------------------------------- class ExcBof -
109// Header Record for WORKSHEETS
110
111class ExcBof : public ExcBof_Base
112{
113private:
114 virtual void SaveCont( XclExpStream& rStrm ) override;
115public:
116 ExcBof();
117
118 virtual sal_uInt16 GetNum() const override;
119 virtual std::size_t GetLen() const override;
120};
121
122//------------------------------------------------------------- class ExcBofW -
123// Header Record for WORKBOOKS
124
125class ExcBofW : public ExcBof_Base
126{
127private:
128 virtual void SaveCont( XclExpStream& rStrm ) override;
129public:
130 ExcBofW();
131
132 virtual sal_uInt16 GetNum() const override;
133 virtual std::size_t GetLen() const override;
134};
135
136//-------------------------------------------------------------- class ExcEof -
137
138class ExcEof : public ExcRecord
139{
140private:
141public:
142 virtual sal_uInt16 GetNum() const override;
143 virtual std::size_t GetLen() const override;
144};
145
146//--------------------------------------------------------- class ExcDummy_00 -
147// INTERFACEHDR to FNGROUPCOUNT (see excrecds.cxx)
148
150{
151private:
152 static const sal_uInt8 pMyData[];
153 static const std::size_t nMyLen;
154public:
155 virtual std::size_t GetLen() const override;
156 virtual const sal_uInt8* GetData() const override;
157};
158
159// EXC_ID_WINDOWPROTECTION
161{
162 public:
163 XclExpWindowProtection(bool bValue);
164
165 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
166};
167
168// EXC_ID_PROTECT Document Protection
170{
171 public:
172 XclExpProtection(bool bValue);
173};
174
176{
178 public:
179 XclExpSheetProtection(bool bValue, SCTAB nTab);
180 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
181};
182
184{
185public:
186 XclExpPassHash(const css::uno::Sequence<sal_Int8>& aHash);
187 virtual ~XclExpPassHash() override;
188
189private:
190 virtual void WriteBody(XclExpStream& rStrm) override;
191
192private:
193 sal_uInt16 mnHash;
194};
195
196//-------------------------------------------------------- class ExcDummy_04x -
197// PASSWORD to BOOKBOOL (see excrecds.cxx), no 1904
198
200{
201private:
202 static const sal_uInt8 pMyData[];
203 static const std::size_t nMyLen;
204public:
205 virtual std::size_t GetLen() const override;
206 virtual const sal_uInt8* GetData() const override;
207};
208
210{
211private:
212 static const sal_uInt8 pMyData[];
213 static const std::size_t nMyLen;
214public:
215 virtual std::size_t GetLen() const override;
216 virtual const sal_uInt8* GetData() const override;
217};
218
219//------------------------------------------------------------- class Exc1904 -
220
221class Exc1904 : public ExcBoolRecord
222{
223public:
224 Exc1904( const ScDocument& rDoc );
225 virtual sal_uInt16 GetNum() const override;
226
227 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
228private:
230};
231
232//------------------------------------------------------ class ExcBundlesheet -
233
235{
236protected:
237 sal_uInt64 m_nStrPos;
238 sal_uInt64 m_nOwnPos; // Position after # and Len
239 sal_uInt16 nGrbit;
241
243
244public:
245 ExcBundlesheetBase( const RootData& rRootData, SCTAB nTab );
246
247 void SetStreamPos(sal_uInt64 const nStrPos) { m_nStrPos = nStrPos; }
248 void UpdateStreamPos( XclExpStream& rStrm );
249
250 virtual sal_uInt16 GetNum() const override;
251};
252
254{
255private:
256 OString aName;
257
258 virtual void SaveCont( XclExpStream& rStrm ) override;
259
260public:
261 ExcBundlesheet( const RootData& rRootData, SCTAB nTab );
262 virtual std::size_t GetLen() const override;
263};
264
265//--------------------------------------------------------- class ExcDummy_02 -
266// sheet dummies: CALCMODE to SETUP
267
269{
270private:
271 static const sal_uInt8 pMyData[];
272 static const std::size_t nMyLen;
273public:
274 virtual std::size_t GetLen() const override;
275 virtual const sal_uInt8* GetData() const override;
276};
277
280{
281public:
282 explicit XclExpCountry( const XclExpRoot& rRoot );
283
284private:
285 sal_uInt16 mnUICountry;
286 sal_uInt16 mnDocCountry;
287
289 virtual void WriteBody( XclExpStream& rStrm ) override;
290};
291
292// XclExpWsbool ===============================================================
293
295{
296public:
297 explicit XclExpWsbool( bool bFitToPages );
298};
299
304{
305public:
306 explicit XclExpXmlSheetPr(
307 bool bFitToPages, SCTAB nScTab, const Color& rTabColor, XclExpFilterManager* pManager );
308
309 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
310
311private:
316};
317
319{
320public:
321 explicit XclExpFiltermode();
322};
323
325{
326public:
327 explicit XclExpAutofilterinfo( const ScAddress& rStartPos, SCCOL nScCol );
328
329 const ScAddress& GetStartPos() const { return maStartPos; }
330 SCCOL GetColCount() const { return static_cast< SCCOL >( GetValue() ); }
331
332private:
334};
335
337{
338private:
341 std::unique_ptr<XclExpString>
343
344protected:
345public:
348
349 bool IsEmpty() const { return (nType == EXC_AFTYPE_NOTUSED); }
350 std::size_t GetTextBytes() const;
351
352 void SetCondition( sal_uInt8 nTp, sal_uInt8 nOp, const OUString* pT );
353
354 void Save( XclExpStream& rStrm );
355 void SaveXml( XclExpXmlStream& rStrm );
356 void SaveText( XclExpStream& rStrm );
357};
358
359class XclExpAutofilter : public XclExpRecord, protected XclExpRoot
360{
361private:
363 {
368 };
370 sal_uInt16 nCol;
371 sal_uInt16 nFlags;
374 std::vector<std::pair<OUString, bool>> maMultiValues; // first->values, second->bDateFormat
375 std::vector<std::pair<::Color, bool>> maColorValues; // first->Color, second->bIsBackgroundColor (vs. TextColor)
376
378 sal_uInt8 nOp, const OUString* pText, bool bSimple = false );
379
380 virtual void WriteBody( XclExpStream& rStrm ) override;
381
382public:
383 XclExpAutofilter( const XclExpRoot& rRoot, sal_uInt16 nC );
384
385 sal_uInt16 GetCol() const { return nCol; }
387
388 bool HasCondition() const;
389 bool AddEntry( const ScQueryEntry& rEntry );
390 void AddMultiValueEntry( const ScQueryEntry& rEntry );
391 void AddColorEntry( const ScQueryEntry& rEntry );
392
393 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
394};
395
397{
398public:
403 explicit ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const ScDBData* pDefinedData );
404 virtual ~ExcAutoFilterRecs() override;
405
406 void AddObjRecs();
407
408 virtual void Save( XclExpStream& rStrm ) override;
409 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
410
411 bool HasFilterMode() const;
412
413private:
414 XclExpAutofilter* GetByCol( SCCOL nCol ); // always 0-based
415 bool IsFiltered( SCCOL nCol );
416
417private:
420
426
427 ScRange maSortRef; // sort area without headers
428 std::vector< std::tuple<ScRange, OUString, bool> > maSortCustomList; // sorted column with list of sorted items
429};
430
433{
434public:
435 explicit XclExpFilterManager( const XclExpRoot& rRoot );
436
440 void InitTabFilter( SCTAB nScTab );
441
444
446 bool HasFilterMode( SCTAB nScTab );
447
448private:
450
452 typedef ::std::map< SCTAB, XclExpTabFilterRef > XclExpTabFilterMap;
453
455};
456
457/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Exc1904(const ScDocument &rDoc)
Definition: excrecds.cxx:254
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:266
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:261
bool bDateCompatibility
Definition: excrecds.hxx:229
XclExpAutofilterList::RecordRefType XclExpAutofilterRef
Definition: excrecds.hxx:419
XclExpRecordList< XclExpAutofilter > XclExpAutofilterList
Definition: excrecds.hxx:418
std::vector< std::tuple< ScRange, OUString, bool > > maSortCustomList
Definition: excrecds.hxx:428
ExcAutoFilterRecs(const XclExpRoot &rRoot, SCTAB nTab, const ScDBData *pDefinedData)
Definition: excrecds.cxx:918
XclExpAutofilter * GetByCol(SCCOL nCol)
Definition: excrecds.cxx:1059
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:1104
XclExpAutofilterList maFilterList
Definition: excrecds.hxx:421
bool HasFilterMode() const
Definition: excrecds.cxx:1140
virtual void Save(XclExpStream &rStrm) override
Overwrite this method to do any operation while saving the record.
Definition: excrecds.cxx:1095
rtl::Reference< XclExpFiltermode > m_pFilterMode
Definition: excrecds.hxx:422
rtl::Reference< XclExpAutofilterinfo > m_pFilterInfo
Definition: excrecds.hxx:423
bool IsFiltered(SCCOL nCol)
Definition: excrecds.cxx:1073
virtual ~ExcAutoFilterRecs() override
Definition: excrecds.cxx:1055
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:196
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:201
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:191
sal_uInt16 nDocType
Definition: excrecds.hxx:100
sal_uInt16 nRupBuild
Definition: excrecds.hxx:102
sal_uInt16 nRupYear
Definition: excrecds.hxx:103
sal_uInt16 nVers
Definition: excrecds.hxx:101
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:173
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:178
ExcBof()
Definition: excrecds.cxx:162
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:168
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:145
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:140
sal_uInt64 m_nOwnPos
Definition: excrecds.hxx:238
sal_uInt16 nGrbit
Definition: excrecds.hxx:239
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:307
void UpdateStreamPos(XclExpStream &rStrm)
Definition: excrecds.cxx:299
void SetStreamPos(sal_uInt64 const nStrPos)
Definition: excrecds.hxx:247
sal_uInt64 m_nStrPos
Definition: excrecds.hxx:237
OString aName
Definition: excrecds.hxx:256
ExcBundlesheet(const RootData &rRootData, SCTAB nTab)
Definition: excrecds.cxx:312
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:328
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:320
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: excrecds.cxx:128
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:133
virtual const sal_uInt8 * GetData() const =0
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:220
virtual const sal_uInt8 * GetData() const override
Definition: excrecds.cxx:225
static const sal_uInt8 pMyData[]
Definition: excrecds.hxx:152
static const std::size_t nMyLen
Definition: excrecds.hxx:153
static const std::size_t nMyLen
Definition: excrecds.hxx:272
static const sal_uInt8 pMyData[]
Definition: excrecds.hxx:271
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:335
virtual const sal_uInt8 * GetData() const override
Definition: excrecds.cxx:340
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:232
static const sal_uInt8 pMyData[]
Definition: excrecds.hxx:202
virtual const sal_uInt8 * GetData() const override
Definition: excrecds.cxx:237
static const std::size_t nMyLen
Definition: excrecds.hxx:203
static const sal_uInt8 pMyData[]
Definition: excrecds.hxx:212
virtual const sal_uInt8 * GetData() const override
Definition: excrecds.cxx:247
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:242
static const std::size_t nMyLen
Definition: excrecds.hxx:213
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:116
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: excrecds.cxx:112
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:121
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:213
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:208
void Save(XclExpStream &rStrm)
Definition: excrecds.cxx:551
void SaveXml(XclExpXmlStream &rStrm)
Definition: excrecds.cxx:586
std::size_t GetTextBytes() const
Definition: excrecds.cxx:539
bool IsEmpty() const
Definition: excrecds.hxx:349
void SetCondition(sal_uInt8 nTp, sal_uInt8 nOp, const OUString *pT)
Definition: excrecds.cxx:544
std::unique_ptr< XclExpString > pText
Definition: excrecds.hxx:342
void SaveText(XclExpStream &rStrm)
Definition: excrecds.cxx:596
virtual sal_uInt16 GetNum() const =0
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:106
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: excrecds.cxx:91
virtual std::size_t GetLen() const =0
virtual void SaveCont(XclExpStream &rStrm)
Definition: excrecds.cxx:97
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record.
Definition: excrecds.cxx:101
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:814
ExcFilterCondition aCond[2]
Definition: excrecds.hxx:373
bool HasCondition() const
Definition: excrecds.cxx:636
std::vector< std::pair<::Color, bool > > maColorValues
Definition: excrecds.hxx:375
XclExpAutofilter(const XclExpRoot &rRoot, sal_uInt16 nC)
Definition: excrecds.cxx:606
void AddColorEntry(const ScQueryEntry &rEntry)
Definition: excrecds.cxx:790
sal_uInt16 nFlags
Definition: excrecds.hxx:371
FilterType meType
Definition: excrecds.hxx:369
sal_uInt16 nCol
Definition: excrecds.hxx:370
std::vector< std::pair< OUString, bool > > maMultiValues
Definition: excrecds.hxx:374
bool AddCondition(ScQueryConnect eConn, sal_uInt8 nType, sal_uInt8 nOp, const OUString *pText, bool bSimple=false)
Definition: excrecds.cxx:616
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: excrecds.cxx:805
void AddMultiValueEntry(const ScQueryEntry &rEntry)
Definition: excrecds.cxx:777
sal_uInt16 GetCol() const
Definition: excrecds.hxx:385
bool AddEntry(const ScQueryEntry &rEntry)
Definition: excrecds.cxx:641
bool HasTop10() const
Definition: excrecds.hxx:386
ScAddress maStartPos
Definition: excrecds.hxx:333
XclExpAutofilterinfo(const ScAddress &rStartPos, SCCOL nScCol)
Definition: excrecds.cxx:523
const ScAddress & GetStartPos() const
Definition: excrecds.hxx:329
SCCOL GetColCount() const
Definition: excrecds.hxx:330
Record which contains a Boolean value.
Definition: xerecord.hxx:255
This record contains the Windows country IDs for the UI and document language.
Definition: excrecds.hxx:280
sal_uInt16 mnUICountry
Definition: excrecds.hxx:285
sal_uInt16 mnDocCountry
The UI country ID.
Definition: excrecds.hxx:286
XclExpCountry(const XclExpRoot &rRoot)
Definition: excrecds.cxx:346
virtual void WriteBody(XclExpStream &rStrm) override
The document country ID.
Definition: excrecds.cxx:355
A record without body.
Definition: xerecord.hxx:184
Sheet filter manager.
Definition: excrecds.hxx:433
rtl::Reference< ExcAutoFilterRecs > XclExpTabFilterRef
Definition: excrecds.hxx:451
bool HasFilterMode(SCTAB nScTab)
Returns whether or not FilterMode is present.
Definition: excrecds.cxx:1167
XclExpRecordRef CreateRecord(SCTAB nScTab)
Returns a record object containing all filter records for the specified sheet.
Definition: excrecds.cxx:1155
::std::map< SCTAB, XclExpTabFilterRef > XclExpTabFilterMap
Definition: excrecds.hxx:452
XclExpFilterManager(const XclExpRoot &rRoot)
Definition: excrecds.cxx:1145
void InitTabFilter(SCTAB nScTab)
Creates the filter records for the specified sheet.
Definition: excrecds.cxx:1150
XclExpTabFilterMap maFilterMap
Definition: excrecds.hxx:454
sal_uInt16 mnHash
Definition: excrecds.hxx:193
XclExpPassHash(const css::uno::Sequence< sal_Int8 > &aHash)
Definition: excrecds.cxx:498
virtual ~XclExpPassHash() override
Definition: excrecds.cxx:509
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: excrecds.cxx:513
XclExpProtection(bool bValue)
Definition: excrecds.cxx:415
Base class for all Excel records.
Definition: xerecord.hxx:39
Base class for single records with any content.
Definition: xerecord.hxx:143
Access to global data from other classes.
Definition: xeroot.hxx:113
XclExpRecordRef CreateRecord(sal_uInt16 nRecId) const
Returns the reference to a record (or record list) representing a root object.
Definition: xeroot.cxx:281
XclExpSheetProtection(bool bValue, SCTAB nTab)
Definition: excrecds.cxx:420
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:426
This class is used to export Excel record streams.
Definition: xestream.hxx:73
A record with a single value of type Type.
Definition: xerecord.hxx:199
const Type & GetValue() const
Returns the value of the record.
Definition: xerecord.hxx:208
XclExpWindowProtection(bool bValue)
Definition: excrecds.cxx:403
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:408
XclExpWsbool(bool bFitToPages)
Definition: excrecds.cxx:362
Save sheetPr element and its children for xlsx export.
Definition: excrecds.hxx:304
XclExpFilterManager * mpManager
Definition: excrecds.hxx:313
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:372
XclExpXmlSheetPr(bool bFitToPages, SCTAB nScTab, const Color &rTabColor, XclExpFilterManager *pManager)
Definition: excrecds.cxx:369
const sal_uInt16 EXC_AFFLAG_TOP10
Definition: excdefs.hxx:33
const sal_uInt8 EXC_AFTYPE_NOTUSED
Definition: excdefs.hxx:38
bool get_flag(Type nBitField, Type nMask)
Returns true, if at least one of the bits set in nMask is set in nBitField.
Definition: ftools.hxx:75
ScQueryConnect
Definition: global.hxx:853
void SvStream & rStrm
QPRO_FUNC_TYPE nType
Definition: qproform.cxx:398
Each instance of this struct represents a single filtering criteria.
Definition: queryentry.hxx:34
unsigned char sal_uInt8
sal_Int16 SCTAB
Definition: types.hxx:22
sal_Int16 SCCOL
Definition: types.hxx:21