fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / sc / source / filter / inc / excrecds.hxx
blobedfb231890e790e23655b2c7caff6c8a1fe44080
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SC_SOURCE_FILTER_INC_EXCRECDS_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_EXCRECDS_HXX
23 #include <rtl/string.hxx>
24 #include <rtl/ustring.hxx>
25 #include <svl/zforlist.hxx>
26 #include <tools/solar.h>
27 #include <tools/color.hxx>
28 #include <vcl/vclenum.hxx>
30 #include "olinetab.hxx"
31 #include "filter.hxx"
32 #include "rangelst.hxx"
33 #include "xerecord.hxx"
34 #include "xeroot.hxx"
35 #include "xeformula.hxx"
36 #include "xestring.hxx"
37 #include "root.hxx"
38 #include "excdefs.hxx"
39 #include <memory>
40 #include <vector>
42 //------------------------------------------------------------------ Forwards -
44 struct ScQueryEntry;
46 //----------------------------------------------------------- class ExcRecord -
48 class ExcRecord : public XclExpRecord
50 public:
51 virtual void Save( XclExpStream& rStrm ) SAL_OVERRIDE;
52 virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
54 virtual sal_uInt16 GetNum() const = 0;
55 virtual sal_Size GetLen() const = 0;
57 protected:
58 virtual void SaveCont( XclExpStream& rStrm );
60 private:
61 /** Writes the body of the record. */
62 virtual void WriteBody( XclExpStream& rStrm ) SAL_OVERRIDE;
65 //--------------------------------------------------------- class ExcEmptyRec -
67 class ExcEmptyRec : public ExcRecord
69 private:
70 protected:
71 public:
72 virtual void Save( XclExpStream& rStrm ) SAL_OVERRIDE;
73 virtual sal_uInt16 GetNum() const SAL_OVERRIDE;
74 virtual sal_Size GetLen() const SAL_OVERRIDE;
77 //--------------------------------------------------------- class ExcDummyRec -
79 class ExcDummyRec : public ExcRecord
81 protected:
82 public:
83 virtual void Save( XclExpStream& rStrm ) SAL_OVERRIDE;
84 virtual sal_uInt16 GetNum() const SAL_OVERRIDE;
85 virtual const sal_uInt8* GetData() const = 0; // byte data must contain header and body
88 //------------------------------------------------------- class ExcBoolRecord -
89 // stores bool as 16bit val ( 0x0000 | 0x0001 )
91 class ExcBoolRecord : public ExcRecord
93 private:
94 virtual void SaveCont( XclExpStream& rStrm ) SAL_OVERRIDE;
96 protected:
97 bool bVal;
99 inline ExcBoolRecord() : bVal( false ) {}
101 public:
102 inline ExcBoolRecord( const bool bDefault ) : bVal( bDefault ) {}
104 virtual sal_Size GetLen() const SAL_OVERRIDE;
107 //--------------------------------------------------------- class ExcBof_Base -
109 class ExcBof_Base : public ExcRecord
111 private:
112 protected:
113 sal_uInt16 nDocType;
114 sal_uInt16 nVers;
115 sal_uInt16 nRupBuild;
116 sal_uInt16 nRupYear;
117 public:
118 ExcBof_Base();
121 //-------------------------------------------------------------- class ExcBof -
122 // Header Record fuer WORKSHEETS
124 class ExcBof : public ExcBof_Base
126 private:
127 virtual void SaveCont( XclExpStream& rStrm ) SAL_OVERRIDE;
128 public:
129 ExcBof();
131 virtual sal_uInt16 GetNum() const SAL_OVERRIDE;
132 virtual sal_Size GetLen() const SAL_OVERRIDE;
135 //------------------------------------------------------------- class ExcBofW -
136 // Header Record fuer WORKBOOKS
138 class ExcBofW : public ExcBof_Base
140 private:
141 virtual void SaveCont( XclExpStream& rStrm ) SAL_OVERRIDE;
142 public:
143 ExcBofW();
145 virtual sal_uInt16 GetNum() const SAL_OVERRIDE;
146 virtual sal_Size GetLen() const SAL_OVERRIDE;
149 //-------------------------------------------------------------- class ExcEof -
151 class ExcEof : public ExcRecord
153 private:
154 public:
155 virtual sal_uInt16 GetNum() const SAL_OVERRIDE;
156 virtual sal_Size GetLen() const SAL_OVERRIDE;
159 //--------------------------------------------------------- class ExcDummy_00 -
160 // INTERFACEHDR to FNGROUPCOUNT (see excrecds.cxx)
162 class ExcDummy_00 : public ExcDummyRec
164 private:
165 static const sal_uInt8 pMyData[];
166 static const sal_Size nMyLen;
167 public:
168 virtual sal_Size GetLen() const SAL_OVERRIDE;
169 virtual const sal_uInt8* GetData() const SAL_OVERRIDE;
172 // EXC_ID_WINDOWPROTECTION
173 class XclExpWindowProtection : public XclExpBoolRecord
175 public:
176 XclExpWindowProtection(bool bValue);
178 virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
181 // EXC_ID_PROTECT Document Protection
182 class XclExpProtection : public XclExpBoolRecord
184 public:
185 XclExpProtection(bool bValue);
188 class XclExpSheetProtection : public XclExpProtection
190 SCTAB mnTab;
191 public:
192 XclExpSheetProtection(bool bValue, SCTAB nTab);
193 virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
196 class XclExpPassHash : public XclExpRecord
198 public:
199 XclExpPassHash(const ::com::sun::star::uno::Sequence<sal_Int8>& aHash);
200 virtual ~XclExpPassHash();
202 private:
203 virtual void WriteBody(XclExpStream& rStrm) SAL_OVERRIDE;
205 private:
206 sal_uInt16 mnHash;
209 //-------------------------------------------------------- class ExcDummy_04x -
210 // PASSWORD to BOOKBOOL (see excrecds.cxx), no 1904
212 class ExcDummy_040 : public ExcDummyRec
214 private:
215 static const sal_uInt8 pMyData[];
216 static const sal_Size nMyLen;
217 public:
218 virtual sal_Size GetLen() const SAL_OVERRIDE;
219 virtual const sal_uInt8* GetData() const SAL_OVERRIDE;
222 class ExcDummy_041 : public ExcDummyRec
224 private:
225 static const sal_uInt8 pMyData[];
226 static const sal_Size nMyLen;
227 public:
228 virtual sal_Size GetLen() const SAL_OVERRIDE;
229 virtual const sal_uInt8* GetData() const SAL_OVERRIDE;
232 //------------------------------------------------------------- class Exc1904 -
234 class Exc1904 : public ExcBoolRecord
236 public:
237 Exc1904( ScDocument& rDoc );
238 virtual sal_uInt16 GetNum() const SAL_OVERRIDE;
240 virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
241 private:
242 bool bDateCompatibility;
245 //------------------------------------------------------ class ExcBundlesheet -
247 class ExcBundlesheetBase : public ExcRecord
249 protected:
250 sal_uInt64 m_nStrPos;
251 sal_uInt64 m_nOwnPos; // Position after # and Len
252 sal_uInt16 nGrbit;
253 SCTAB nTab;
255 ExcBundlesheetBase();
257 public:
258 ExcBundlesheetBase( RootData& rRootData, SCTAB nTab );
260 inline void SetStreamPos(sal_uInt64 const nStrPos) { m_nStrPos = nStrPos; }
261 void UpdateStreamPos( XclExpStream& rStrm );
263 virtual sal_uInt16 GetNum() const SAL_OVERRIDE;
266 class ExcBundlesheet : public ExcBundlesheetBase
268 private:
269 OString aName;
271 virtual void SaveCont( XclExpStream& rStrm ) SAL_OVERRIDE;
273 public:
274 ExcBundlesheet( RootData& rRootData, SCTAB nTab );
275 virtual sal_Size GetLen() const SAL_OVERRIDE;
278 //--------------------------------------------------------- class ExcDummy_02 -
279 // sheet dummies: CALCMODE to SETUP
281 class ExcDummy_02a : public ExcDummyRec
283 private:
284 static const sal_uInt8 pMyData[];
285 static const sal_Size nMyLen;
286 public:
287 virtual sal_Size GetLen() const SAL_OVERRIDE;
288 virtual const sal_uInt8* GetData() const SAL_OVERRIDE;
291 /** This record contains the Windows country IDs for the UI and document language. */
292 class XclExpCountry : public XclExpRecord
294 public:
295 explicit XclExpCountry( const XclExpRoot& rRoot );
297 private:
298 sal_uInt16 mnUICountry; /// The UI country ID.
299 sal_uInt16 mnDocCountry; /// The document country ID.
301 /** Writes the body of the COUNTRY record. */
302 virtual void WriteBody( XclExpStream& rStrm ) SAL_OVERRIDE;
305 // XclExpWsbool ===============================================================
307 class XclExpWsbool : public XclExpUInt16Record
309 public:
310 explicit XclExpWsbool( bool bFitToPages );
314 * Save sheetPr element and its children for xlsx export.
316 class XclExpXmlSheetPr : public XclExpRecordBase
318 public:
319 explicit XclExpXmlSheetPr(
320 bool bFitToPages, SCTAB nScTab, const Color& rTabColor, XclExpFilterManager* pManager );
322 virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
324 private:
325 SCTAB mnScTab;
326 XclExpFilterManager* mpManager;
327 bool mbFitToPage;
328 Color maTabColor;
331 class XclExpFiltermode : public XclExpEmptyRecord
333 public:
334 explicit XclExpFiltermode();
337 class XclExpAutofilterinfo : public XclExpUInt16Record
339 public:
340 explicit XclExpAutofilterinfo( const ScAddress& rStartPos, SCCOL nScCol );
342 inline const ScAddress GetStartPos() const { return maStartPos; }
343 inline SCCOL GetColCount() const { return static_cast< SCCOL >( GetValue() ); }
345 private:
346 ScAddress maStartPos;
349 class ExcFilterCondition
351 private:
352 sal_uInt8 nType;
353 sal_uInt8 nOper;
354 double fVal;
355 XclExpString* pText;
357 protected:
358 public:
359 ExcFilterCondition();
360 ~ExcFilterCondition();
362 inline bool IsEmpty() const { return (nType == EXC_AFTYPE_NOTUSED); }
363 inline bool HasEqual() const { return (nOper == EXC_AFOPER_EQUAL); }
364 sal_uLong GetTextBytes() const;
366 void SetCondition( sal_uInt8 nTp, sal_uInt8 nOp, double fV, OUString* pT );
368 void Save( XclExpStream& rStrm );
369 void SaveXml( XclExpXmlStream& rStrm );
370 void SaveText( XclExpStream& rStrm );
373 class XclExpAutofilter : public XclExpRecord, protected XclExpRoot
375 private:
376 enum FilterType { FilterCondition, MultiValue };
377 FilterType meType;
378 sal_uInt16 nCol;
379 sal_uInt16 nFlags;
380 ExcFilterCondition aCond[ 2 ];
381 std::vector<OUString> maMultiValues;
383 bool AddCondition( ScQueryConnect eConn, sal_uInt8 nType,
384 sal_uInt8 nOp, double fVal, OUString* pText,
385 bool bSimple = false );
387 virtual void WriteBody( XclExpStream& rStrm ) SAL_OVERRIDE;
389 public:
390 XclExpAutofilter( const XclExpRoot& rRoot, sal_uInt16 nC );
392 inline sal_uInt16 GetCol() const { return nCol; }
393 inline bool HasTop10() const { return ::get_flag( nFlags, EXC_AFFLAG_TOP10 ); }
395 bool HasCondition() const;
396 bool AddEntry( const ScQueryEntry& rEntry );
397 bool AddMultiValueEntry( const ScQueryEntry& rEntry );
399 virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
402 class ExcAutoFilterRecs : public XclExpRecordBase, protected XclExpRoot
404 public:
405 explicit ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab );
406 virtual ~ExcAutoFilterRecs();
408 void AddObjRecs();
410 virtual void Save( XclExpStream& rStrm ) SAL_OVERRIDE;
411 virtual void SaveXml( XclExpXmlStream& rStrm ) SAL_OVERRIDE;
413 bool HasFilterMode() const;
415 private:
416 XclExpAutofilter* GetByCol( SCCOL nCol ); // always 0-based
417 bool IsFiltered( SCCOL nCol );
419 private:
420 typedef XclExpRecordList< XclExpAutofilter > XclExpAutofilterList;
421 typedef XclExpAutofilterList::RecordRefType XclExpAutofilterRef;
423 XclExpAutofilterList maFilterList;
424 XclExpFiltermode* pFilterMode;
425 XclExpAutofilterinfo* pFilterInfo;
426 ScRange maRef;
427 bool mbAutoFilter;
430 /** Sheet filter manager. Contains auto filters or advanced filters from all sheets. */
431 class XclExpFilterManager : protected XclExpRoot
433 public:
434 explicit XclExpFilterManager( const XclExpRoot& rRoot );
436 /** Creates the filter records for the specified sheet.
437 @descr Creates and inserts related built-in NAME records. Therefore this
438 function is called from the name buffer itself. */
439 void InitTabFilter( SCTAB nScTab );
441 /** Returns a record object containing all filter records for the specified sheet. */
442 XclExpRecordRef CreateRecord( SCTAB nScTab );
444 /** Returns whether or not FilterMode is present */
445 bool HasFilterMode( SCTAB nScTab );
447 private:
448 using XclExpRoot::CreateRecord;
450 typedef std::shared_ptr< ExcAutoFilterRecs > XclExpTabFilterRef;
451 typedef ::std::map< SCTAB, XclExpTabFilterRef > XclExpTabFilterMap;
453 XclExpTabFilterMap maFilterMap;
456 #endif
458 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */