1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_SCFLT_HXX
21 #define INCLUDED_SC_SOURCE_FILTER_INC_SCFLT_HXX
23 #include "viewopti.hxx"
24 #include "collect.hxx"
25 #include <tools/solar.h>
28 #define errUnknownFormat 1
29 #define errUnknownID 2
30 #define errOutOfMemory 3
32 // Identifiers in FileFormat
45 #define crfSoftBreak 1
46 #define crfHardBreak 2
56 #define ffDontCare 0x00
61 #define ffDecorative 0x50
73 // Horizontal alignment
84 #define ojWordBreak 0x01
85 #define ojBottomTop 0x02
86 #define ojTopBottom 0x04
97 #define paHideFormula 2
101 // Number format flags
111 #define vfStandardRed 9
112 #define vfMoneyRed 10
113 #define vfThousendRed 11
114 #define vfPercentRed 12
115 #define vfExponentRed 13
120 #define df_NDMY_Long 0
121 #define df_DMY_Long 1
123 #define df_NDM_Long 3
126 #define df_NDMY_Short 6
127 #define df_DMY_Short 7
128 #define df_MY_Short 8
129 #define df_NDM_Short 9
130 #define df_DM_Short 10
131 #define df_M_Short 11
133 #define df_Q_Short 13
136 #define tf_HMS_Long 0
138 #define tf_HMS_Short 2
139 #define tf_HM_Short 3
141 // Attributes for format template
144 #define pfJustify 0x04
146 #define pfRaster 0x10
147 #define pfProtection 0x20
149 // Display flags for table
150 #define dfFormula 0x0001 // formula
151 #define dfZerro 0x0002 // zero values
152 #define dfGrid 0x0004 // grid
153 #define dfSyntax 0x0020 // Syntax Highlighting
154 #define dfObjectAll 0x0080 // show objects
155 #define dfObjectFrame 0x0100 // objects as place holder
156 #define dfObjectNone 0x0200 // do not show objects
157 #define dfNoteMark 0x0400 // NoteMark
176 struct Sc10ValueFormat
178 sal_uInt8 Format
; // number, currency, percentage,...
179 sal_uInt8 Info
; // number of decimals, or positions, or Date/Time format
192 sal_Int16 lfEscapement
;
193 sal_Int16 lfOrientation
;
196 sal_uInt8 lfUnderline
;
197 sal_uInt8 lfStrikeOut
;
199 sal_uInt8 lfOutPrecision
;
200 sal_uInt8 lfClipPrecision
;
202 sal_uInt8 lfPitchAndFamily
;
203 sal_Char lfFaceName
[32];
218 , lfPitchAndFamily(0)
220 memset(lfFaceName
, 0, sizeof(lfFaceName
));
223 bool operator==( const Sc10LogFont
& rData
) const;
233 bool operator==( const Sc10Color
& rColor
) const;
260 struct Sc10DataBaseRec
266 sal_Int16 SortField0
;
267 sal_uInt8 SortUpOrder0
;
268 sal_Int16 SortField1
;
269 sal_uInt8 SortUpOrder1
;
270 sal_Int16 SortField2
;
271 sal_uInt8 SortUpOrder2
;
272 sal_uInt8 IncludeFormat
;
273 sal_Int16 QueryField0
;
275 sal_uInt8 QueryByString0
;
276 sal_Char QueryString0
[64];
278 sal_Int16 QueryConnect1
;
279 sal_Int16 QueryField1
;
281 sal_uInt8 QueryByString1
;
282 sal_Char QueryString1
[64];
284 sal_Int16 QueryConnect2
;
285 sal_Int16 QueryField2
;
287 sal_uInt8 QueryByString2
;
288 sal_Char QueryString2
[64];
315 memset(Name
, 0, sizeof(Name
));
316 memset(QueryString0
, 0, sizeof(QueryString0
));
317 memset(QueryString1
, 0, sizeof(QueryString1
));
318 memset(QueryString2
, 0, sizeof(QueryString2
));
323 struct Sc10HeadFootLine
327 sal_uInt8 HorJustify
;
328 sal_uInt8 VerJustify
;
333 Sc10Color RasterColor
;
334 sal_uInt16 FrameColor
; // Nibble coded colors left-top right-bottom
337 bool operator==( const Sc10HeadFootLine
& rData
) const;
341 struct Sc10PageFormat
343 Sc10HeadFootLine HeadLine
;
344 Sc10HeadFootLine FootLine
;
345 sal_Int16 Orientation
;
348 sal_Int16 NonPrintableX
;
349 sal_Int16 NonPrintableY
;
359 sal_uInt8 PrintColRow
;
361 sal_uInt8 TopBottomDir
;
362 sal_Char PrintAreaName
[32];
363 Sc10BlockRect PrintArea
;
364 sal_Char PrnZoom
[6]; // Pascal 6 Byte RealNumber
366 sal_Int16 RowRepeatStart
;
367 sal_Int16 RowRepeatEnd
;
368 sal_Int16 ColRepeatStart
;
369 sal_Int16 ColRepeatEnd
;
370 sal_Char Reserved
[26];
372 bool operator==( const Sc10PageFormat
& rData
) const;
376 struct Sc10TableProtect
378 sal_Char PassWord
[16];
383 // Document protection
384 struct Sc10SheetProtect
386 sal_Char PassWord
[16];
393 memset(PassWord
, 0, sizeof(PassWord
));
397 // FileHeader StarCalc 1.0 Datei
398 struct Sc10FileHeader
400 sal_Char CopyRight
[30];
402 sal_Char Reserved
[32];
405 // User-Defined File Definition
412 sal_Char InfoLabel0
[16];
413 sal_Char InfoLabel1
[16];
414 sal_Char InfoLabel2
[16];
415 sal_Char InfoLabel3
[16];
420 sal_Char CreateAuthor
[64];
421 sal_Char ChangeAuthor
[64];
422 sal_Char PrintAuthor
[64];
423 Sc10DateTime CreateDate
;
424 Sc10DateTime ChangeDate
;
425 Sc10DateTime PrintDate
;
426 sal_uInt32 PageCount
;
427 sal_uInt32 ChartCount
;
428 sal_uInt32 PictureCount
;
429 sal_uInt32 GraphCount
;
431 sal_uInt32 NoteCount
;
432 sal_uInt32 TextCellCount
;
433 sal_uInt32 ValueCellCount
;
434 sal_uInt32 FormulaCellCount
;
435 sal_uInt32 CellCount
;
436 sal_Char Reserved
[52];
439 // Last Cursor position
440 struct Sc10EditStateInfo
446 // left-top corner of the table
450 // redundant in StarCalc 3.0
451 sal_uInt8 DataBaseMode
;
452 sal_Char Reserved
[51];
462 // Cell-Attribute definition
473 ~Sc10ColAttr() { delete [] pData
; }
477 struct Sc10GraphHeader
479 sal_uInt8 Typ
; // Type of Grafik (Ole-Objekt, Image (Bitmap of MetaFile), Chart-Object)
480 sal_Int16 CarretX
; // Cell Position of Grafik
483 sal_Int32 x
; // x,y distance to cell border in pixels (pixels, as Grafics are stored in window)
485 sal_Int32 w
; // w,h width and height in pixels
487 sal_uInt8 IsRelPos
; // position relativ to cell, or absolute in the table
488 sal_uInt8 DoPrint
; // print Grafic?
489 sal_uInt16 FrameType
; // Frame type around Grafic (none, simple, double, simple thick, double thick)
490 sal_uInt8 IsTransparent
; // show background?
491 Sc10Color FrameColor
; // FrameColor as RGB value
492 Sc10Color BackColor
; // BackGroundColor as RGB value
493 sal_Char Reserved
[32]; // Reserved
497 struct Sc10ImageHeader
499 sal_Char FileName
[128]; // file name of the original inserted image
500 sal_Int16 Typ
; // image type (Bitmap or Metafile)
501 sal_uInt8 Linked
; // not possible
502 sal_Int16 x1
; // original image size (only for Metafiles)
506 sal_uInt32 Size
; // image size in BYTES
510 struct Sc10ChartHeader
512 sal_Int16 MM
; // Meatfile structure MapMode, Width, Hight
515 sal_uInt32 Size
; // image size in BYTES
519 struct Sc10ChartSheetData
521 sal_uInt8 HasTitle
; // has the Chart a title in the table
522 sal_Int16 TitleX
; // cell position of title
524 sal_uInt8 HasSubTitle
; // has the Chart a sub-title in the table
525 sal_Int16 SubTitleX
; // cell position of sub-title
527 sal_uInt8 HasLeftTitle
; // has the Chart a left-title in the table
528 sal_Int16 LeftTitleX
; // cell position of left-title
529 sal_Int16 LeftTitleY
;
530 sal_uInt8 HasLegend
; // has the Chart a legend in the table
531 sal_Int16 LegendX1
; // cells for legend
535 sal_uInt8 HasLabel
; // has the Chart axis labels in the table
536 sal_Int16 LabelX1
; // cells for axis labels
540 sal_Int16 DataX1
; // cells for Data
544 sal_Char Reserved
[64];
547 typedef sal_Char Sc10ChartText
[30];
549 struct Sc10ChartTypeData
555 sal_Int16 GraphStyle
;
556 sal_Char GraphTitle
[80];
557 sal_Char BottomTitle
[80];
558 sal_Int16 SymbolData
[256];
559 sal_Int16 ColorData
[256];
560 sal_Int16 ThickLines
[256];
561 sal_Int16 PatternData
[256];
562 sal_Int16 LinePatternData
[256];
563 sal_Int16 NumGraphStyles
[11];
564 sal_Int16 ShowLegend
;
565 Sc10ChartText LegendText
[256];
566 sal_Int16 ExplodePie
;
568 sal_Int16 FontFamily
[5];
569 sal_Int16 FontStyle
[5];
570 sal_Int16 FontSize
[5];
573 sal_Int16 LabelEvery
;
574 Sc10ChartText LabelText
[50];
575 sal_Char LeftTitle
[80];
576 sal_Char Reserved
[4646];
580 class Sc10FontData
: public ScDataObject
585 sal_uInt8 PitchAndFamily
;
586 sal_Char FaceName
[32];
588 Sc10FontData( const Sc10FontData
& rData
)
589 : ScDataObject( rData
)
590 , Height( rData
.Height
)
591 , CharSet( rData
.CharSet
)
592 , PitchAndFamily( rData
.PitchAndFamily
)
594 strncpy( FaceName
, rData
.FaceName
, sizeof(FaceName
) );
595 FaceName
[sizeof(FaceName
)-1] = 0;
597 Sc10FontData( SvStream
& rStream
);
598 virtual ScDataObject
* Clone() const SAL_OVERRIDE
{ return new Sc10FontData(*this); }
602 class Sc10FontCollection
: public ScCollection
607 Sc10FontCollection( SvStream
& rStream
);
608 sal_uLong
GetError() { return nError
; }
609 Sc10FontData
* At(sal_uInt16 nIndex
) { return static_cast<Sc10FontData
*>(ScCollection::At(nIndex
)); }
611 using ScCollection::At
;
615 class Sc10NameData
: public ScDataObject
619 sal_Char Reference
[64];
620 sal_Char Reserved
[12];
622 Sc10NameData(const Sc10NameData
& rData
) :
623 ScDataObject( rData
)
625 strncpy(Name
, rData
.Name
, sizeof(Name
));
626 Name
[sizeof(Name
)-1] = 0;
627 strncpy(Reference
, rData
.Reference
, sizeof(Reference
));
628 Reference
[sizeof(Reference
)-1] = 0;
629 memcpy(Reserved
, rData
.Reserved
, sizeof(Reserved
));
631 Sc10NameData(SvStream
& rStream
);
632 virtual ScDataObject
* Clone() const SAL_OVERRIDE
{ return new Sc10NameData(*this); }
636 class Sc10NameCollection
: public ScCollection
641 Sc10NameCollection(SvStream
& rStream
);
642 sal_uLong
GetError() { return nError
; }
643 Sc10NameData
* At(sal_uInt16 nIndex
) { return static_cast<Sc10NameData
*>(ScCollection::At(nIndex
)); }
645 using ScCollection::At
;
649 class Sc10PatternData
: public ScDataObject
653 Sc10ValueFormat ValueFormat
;
660 sal_uInt16 FrameColor
;
662 sal_uInt16 FormatFlags
;
663 sal_Char Reserved
[8];
665 Sc10PatternData(const Sc10PatternData
& rData
) :
666 ScDataObject( rData
)
668 strncpy(Name
, rData
.Name
, sizeof(Name
));
669 Name
[sizeof(Name
)-1] = 0;
670 memcpy(&ValueFormat
, &rData
.ValueFormat
, sizeof(ValueFormat
));
671 memcpy(&LogFont
, &rData
.LogFont
, sizeof(LogFont
));
673 Justify
= rData
.Justify
;
675 Raster
= rData
.Raster
;
676 nColor
= rData
.nColor
;
677 FrameColor
= rData
.FrameColor
;
679 FormatFlags
= rData
.FormatFlags
;
680 memcpy(Reserved
, rData
.Reserved
, sizeof(Reserved
));
682 Sc10PatternData(SvStream
& rStream
);
683 virtual ScDataObject
* Clone() const SAL_OVERRIDE
{ return new Sc10PatternData(*this); }
686 // Template-Collection
687 class Sc10PatternCollection
: public ScCollection
692 Sc10PatternCollection(SvStream
& rStream
);
693 sal_uLong
GetError() { return nError
; }
694 Sc10PatternData
* At(sal_uInt16 nIndex
) { return static_cast<Sc10PatternData
*>(ScCollection::At(nIndex
)); }
696 using ScCollection::At
;
700 class Sc10DataBaseData
: public ScDataObject
703 Sc10DataBaseRec DataBaseRec
;
705 Sc10DataBaseData(const Sc10DataBaseData
& rData
) :
706 ScDataObject( rData
)
708 memcpy(&DataBaseRec
, &rData
.DataBaseRec
, sizeof(DataBaseRec
));
710 Sc10DataBaseData(SvStream
& rStream
);
711 virtual ScDataObject
* Clone() const SAL_OVERRIDE
{ return new Sc10DataBaseData(*this); }
714 // DataBank-Collection
715 class Sc10DataBaseCollection
: public ScCollection
719 sal_Char ActName
[32];
721 Sc10DataBaseCollection(SvStream
& rStream
);
722 sal_uLong
GetError() { return nError
; }
723 Sc10DataBaseData
* At(sal_uInt16 nIndex
) { return static_cast<Sc10DataBaseData
*>(ScCollection::At(nIndex
)); }
725 using ScCollection::At
;
728 class Sc10PageData
: public ScDataObject
731 Sc10PageFormat aPageFormat
;
732 Sc10PageData( const Sc10PageFormat
& rFormat
) : aPageFormat(rFormat
) {}
733 bool operator==( const Sc10PageData
& rData
) const
734 { return aPageFormat
== rData
.aPageFormat
; }
735 virtual ScDataObject
* Clone() const SAL_OVERRIDE
;
738 // PageFormat-Collection
739 class Sc10PageCollection
: public ScCollection
742 Sc10PageCollection() : ScCollection(1,1) {};
743 Sc10PageData
* At(sal_uInt16 nIndex
) { return static_cast<Sc10PageData
*>(ScCollection::At(nIndex
)); }
744 sal_uInt16
InsertFormat( const Sc10PageFormat
& rData
);
745 void PutToDoc( ScDocument
* pDoc
);
747 using ScCollection::At
;
750 class ScfStreamProgressBar
;
757 Sc10Color TextPalette
[16];
758 Sc10Color BackPalette
[16];
759 Sc10Color RasterPalette
[16];
760 Sc10Color FramePalette
[16];
761 Sc10SheetProtect SheetProtect
;
762 Sc10FontCollection
* pFontCollection
;
763 Sc10NameCollection
* pNameCollection
;
764 Sc10PatternCollection
* pPatternCollection
;
765 Sc10DataBaseCollection
* pDataBaseCollection
;
768 ScViewOptions aSc30ViewOpt
;
769 ScfStreamProgressBar
* pPrgrsBar
;
772 Sc10Import( SvStream
& rStr
, ScDocument
* pDocument
);
776 void LoadFileHeader();
778 void LoadEditStateInfo();
780 void LoadViewColRowBar();
783 void LoadFontCollection();
784 void LoadNameCollection();
785 void ImportNameCollection();
786 void LoadPatternCollection();
787 void LoadDataBaseCollection();
789 void LoadCol(SCCOL Col
, SCTAB Tab
);
790 void LoadColAttr(SCCOL Col
, SCTAB Tab
);
791 void LoadAttr(Sc10ColAttr
& rAttr
);
792 static void ChangeFormat(sal_uInt16 nFormat
, sal_uInt16 nInfo
, sal_uLong
& nKey
);
798 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */