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 {
369 };
371 sal_uInt16 nCol;
373 sal_uInt16 nFlags;
376 std::vector<std::pair<OUString, bool>> maMultiValues; // first->values, second->bDateFormat
377 std::vector<std::pair<::Color, bool>> maColorValues; // first->Color, second->bIsBackgroundColor (vs. TextColor)
378
380 sal_uInt8 nOp, const OUString* pText, bool bSimple = false );
381
382 virtual void WriteBody( XclExpStream& rStrm ) override;
383
384public:
385 XclExpAutofilter( const XclExpRoot& rRoot, sal_uInt16 nC, bool bIsEmpty = false );
386
387 sal_uInt16 GetCol() const { return nCol; }
389
390 bool HasCondition() const;
391 bool AddEntry( const ScQueryEntry& rEntry );
392 void AddMultiValueEntry( const ScQueryEntry& rEntry );
393 void SetButtonHidden(bool bValue) { bIsButtonHidden = bValue; }
394 void AddColorEntry( const ScQueryEntry& rEntry );
395
396 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
397};
398
400{
401public:
406 explicit ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const ScDBData* pDefinedData );
407 virtual ~ExcAutoFilterRecs() override;
408
409 void AddObjRecs();
410
411 virtual void Save( XclExpStream& rStrm ) override;
412 virtual void SaveXml( XclExpXmlStream& rStrm ) override;
413
414 bool HasFilterMode() const;
415
416private:
417 XclExpAutofilter* GetByCol( SCCOL nCol ); // always 0-based
418 bool IsFiltered( SCCOL nCol );
419
420private:
423
429
430 ScRange maSortRef; // sort area without headers
431 std::vector< std::tuple<ScRange, OUString, bool> > maSortCustomList; // sorted column with list of sorted items
432};
433
436{
437public:
438 explicit XclExpFilterManager( const XclExpRoot& rRoot );
439
443 void InitTabFilter( SCTAB nScTab );
444
447
449 bool HasFilterMode( SCTAB nScTab );
450
451private:
453
455 typedef ::std::map< SCTAB, XclExpTabFilterRef > XclExpTabFilterMap;
456
458};
459
460/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Exc1904(const ScDocument &rDoc)
Definition: excrecds.cxx:256
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:268
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:263
bool bDateCompatibility
Definition: excrecds.hxx:229
XclExpAutofilterList::RecordRefType XclExpAutofilterRef
Definition: excrecds.hxx:422
XclExpRecordList< XclExpAutofilter > XclExpAutofilterList
Definition: excrecds.hxx:421
std::vector< std::tuple< ScRange, OUString, bool > > maSortCustomList
Definition: excrecds.hxx:431
ExcAutoFilterRecs(const XclExpRoot &rRoot, SCTAB nTab, const ScDBData *pDefinedData)
Definition: excrecds.cxx:925
XclExpAutofilter * GetByCol(SCCOL nCol)
Definition: excrecds.cxx:1101
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:1146
XclExpAutofilterList maFilterList
Definition: excrecds.hxx:424
bool HasFilterMode() const
Definition: excrecds.cxx:1182
virtual void Save(XclExpStream &rStrm) override
Overwrite this method to do any operation while saving the record.
Definition: excrecds.cxx:1137
rtl::Reference< XclExpFiltermode > m_pFilterMode
Definition: excrecds.hxx:425
rtl::Reference< XclExpAutofilterinfo > m_pFilterInfo
Definition: excrecds.hxx:426
bool IsFiltered(SCCOL nCol)
Definition: excrecds.cxx:1115
virtual ~ExcAutoFilterRecs() override
Definition: excrecds.cxx:1097
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:198
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:203
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:193
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:175
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:180
ExcBof()
Definition: excrecds.cxx:164
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:170
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:147
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:142
sal_uInt64 m_nOwnPos
Definition: excrecds.hxx:238
sal_uInt16 nGrbit
Definition: excrecds.hxx:239
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:309
void UpdateStreamPos(XclExpStream &rStrm)
Definition: excrecds.cxx:301
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:314
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:330
virtual void SaveCont(XclExpStream &rStrm) override
Definition: excrecds.cxx:322
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: excrecds.cxx:130
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:135
virtual const sal_uInt8 * GetData() const =0
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:222
virtual const sal_uInt8 * GetData() const override
Definition: excrecds.cxx:227
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:337
virtual const sal_uInt8 * GetData() const override
Definition: excrecds.cxx:342
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:234
static const sal_uInt8 pMyData[]
Definition: excrecds.hxx:202
virtual const sal_uInt8 * GetData() const override
Definition: excrecds.cxx:239
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:249
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:244
static const std::size_t nMyLen
Definition: excrecds.hxx:213
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:118
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: excrecds.cxx:114
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:123
virtual std::size_t GetLen() const override
Definition: excrecds.cxx:215
virtual sal_uInt16 GetNum() const override
Definition: excrecds.cxx:210
void Save(XclExpStream &rStrm)
Definition: excrecds.cxx:553
void SaveXml(XclExpXmlStream &rStrm)
Definition: excrecds.cxx:588
std::size_t GetTextBytes() const
Definition: excrecds.cxx:541
bool IsEmpty() const
Definition: excrecds.hxx:349
void SetCondition(sal_uInt8 nTp, sal_uInt8 nOp, const OUString *pT)
Definition: excrecds.cxx:546
std::unique_ptr< XclExpString > pText
Definition: excrecds.hxx:342
void SaveText(XclExpStream &rStrm)
Definition: excrecds.cxx:598
virtual sal_uInt16 GetNum() const =0
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:108
virtual void Save(XclExpStream &rStrm) override
Writes the record header and calls WriteBody().
Definition: excrecds.cxx:93
virtual std::size_t GetLen() const =0
virtual void SaveCont(XclExpStream &rStrm)
Definition: excrecds.cxx:99
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record.
Definition: excrecds.cxx:103
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:817
ExcFilterCondition aCond[2]
Definition: excrecds.hxx:375
bool HasCondition() const
Definition: excrecds.cxx:639
XclExpAutofilter(const XclExpRoot &rRoot, sal_uInt16 nC, bool bIsEmpty=false)
Definition: excrecds.cxx:608
void SetButtonHidden(bool bValue)
Definition: excrecds.hxx:393
std::vector< std::pair<::Color, bool > > maColorValues
Definition: excrecds.hxx:377
void AddColorEntry(const ScQueryEntry &rEntry)
Definition: excrecds.cxx:793
sal_uInt16 nFlags
Definition: excrecds.hxx:373
FilterType meType
Definition: excrecds.hxx:370
sal_uInt16 nCol
Definition: excrecds.hxx:371
std::vector< std::pair< OUString, bool > > maMultiValues
Definition: excrecds.hxx:376
bool AddCondition(ScQueryConnect eConn, sal_uInt8 nType, sal_uInt8 nOp, const OUString *pText, bool bSimple=false)
Definition: excrecds.cxx:619
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: excrecds.cxx:808
void AddMultiValueEntry(const ScQueryEntry &rEntry)
Definition: excrecds.cxx:780
sal_uInt16 GetCol() const
Definition: excrecds.hxx:387
bool AddEntry(const ScQueryEntry &rEntry)
Definition: excrecds.cxx:644
bool HasTop10() const
Definition: excrecds.hxx:388
ScAddress maStartPos
Definition: excrecds.hxx:333
XclExpAutofilterinfo(const ScAddress &rStartPos, SCCOL nScCol)
Definition: excrecds.cxx:525
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:348
virtual void WriteBody(XclExpStream &rStrm) override
The document country ID.
Definition: excrecds.cxx:357
A record without body.
Definition: xerecord.hxx:184
Sheet filter manager.
Definition: excrecds.hxx:436
rtl::Reference< ExcAutoFilterRecs > XclExpTabFilterRef
Definition: excrecds.hxx:454
bool HasFilterMode(SCTAB nScTab)
Returns whether or not FilterMode is present.
Definition: excrecds.cxx:1209
XclExpRecordRef CreateRecord(SCTAB nScTab)
Returns a record object containing all filter records for the specified sheet.
Definition: excrecds.cxx:1197
::std::map< SCTAB, XclExpTabFilterRef > XclExpTabFilterMap
Definition: excrecds.hxx:455
XclExpFilterManager(const XclExpRoot &rRoot)
Definition: excrecds.cxx:1187
void InitTabFilter(SCTAB nScTab)
Creates the filter records for the specified sheet.
Definition: excrecds.cxx:1192
XclExpTabFilterMap maFilterMap
Definition: excrecds.hxx:457
sal_uInt16 mnHash
Definition: excrecds.hxx:193
XclExpPassHash(const css::uno::Sequence< sal_Int8 > &aHash)
Definition: excrecds.cxx:500
virtual ~XclExpPassHash() override
Definition: excrecds.cxx:511
virtual void WriteBody(XclExpStream &rStrm) override
Writes the body of the record (without record header).
Definition: excrecds.cxx:515
XclExpProtection(bool bValue)
Definition: excrecds.cxx:417
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:282
XclExpSheetProtection(bool bValue, SCTAB nTab)
Definition: excrecds.cxx:422
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:428
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:405
virtual void SaveXml(XclExpXmlStream &rStrm) override
Definition: excrecds.cxx:410
XclExpWsbool(bool bFitToPages)
Definition: excrecds.cxx:364
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:374
XclExpXmlSheetPr(bool bFitToPages, SCTAB nScTab, const Color &rTabColor, XclExpFilterManager *pManager)
Definition: excrecds.cxx:371
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:854
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