1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: scflt.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
34 #include "viewopti.hxx"
35 #include "collect.hxx"
36 #include <tools/solar.h>
39 #define errUnknownFormat 1
40 #define errUnknownID 2
41 #define errOutOfMemory 3
43 // Identifiers im FileFormat
55 // Zeilen/Spalten Flags
56 #define crfSoftBreak 1
57 #define crfHardBreak 2
67 #define ffDontCare 0x00
72 #define ffDecorative 0x50
84 // Horizontale Ausrichtung
90 // Vertikale Ausrichtung
97 #define ojWordBreak 0x01
98 #define ojBottomTop 0x02
99 #define ojTopBottom 0x04
111 #define paHideFormula 2
113 #define paHidePrint 8
125 #define vfStandardRed 9
126 #define vfMoneyRed 10
127 #define vfThousendRed 11
128 #define vfPercentRed 12
129 #define vfExponentRed 13
135 #define df_NDMY_Long 0
136 #define df_DMY_Long 1
138 #define df_NDM_Long 3
141 #define df_NDMY_Short 6
142 #define df_DMY_Short 7
143 #define df_MY_Short 8
144 #define df_NDM_Short 9
145 #define df_DM_Short 10
146 #define df_M_Short 11
148 #define df_Q_Short 13
151 #define tf_HMS_Long 0
153 #define tf_HMS_Short 2
154 #define tf_HM_Short 3
156 // Attribute fuer FormatVorlage
159 #define pfJustify 0x04
161 #define pfRaster 0x10
162 #define pfProtection 0x20
164 // Displayflags fuer die Tabelle
165 #define dfFormula 0x0001 // Formeln
166 #define dfZerro 0x0002 // Nullwerte
167 #define dfGrid 0x0004 // Gitternetz
168 #define dfPageBreak 0x0008 // Seitenumbruch
169 #define dfColRowBar 0x0010 // Zeilen/Spalten Koepfe (Dummy)
170 #define dfSyntax 0x0020 // Syntax Highlighting
171 #define dfPrintPage 0x0040 // Druckbildansicht (Dummy)
172 #define dfObjectAll 0x0080 // Objekte anzeigen
173 #define dfObjectFrame 0x0100 // Objekte als Platzhalter
174 #define dfObjectNone 0x0200 // Objekte nicht anzeigen
175 #define dfNoteMark 0x0400 // Notizanzeiger
176 #define dfProtectMark 0x0800 // Schutzanzeiger
179 #define otNone 0 // s.u.
185 #define gtNone 0 // Kann nicht vorkommen
186 #define gtOle 1 // Ole 1.0 Objekt
187 #define gtImage 2 // Image (Bitmap oder Metafile)
188 #define gtChart 3 // Chart
202 struct Sc10ValueFormat
204 BYTE Format
; // Zahl, Waehrung, Prozent etc.
205 BYTE Info
; // Anzahl Nachkommastellen, Anzahl Stellen, bzw. Datums/Zeitformat
221 BYTE lfClipPrecision
;
223 BYTE lfPitchAndFamily
;
224 sal_Char lfFaceName
[32];
226 int operator==( const Sc10LogFont
& rData
) const;
236 int operator==( const Sc10Color
& rColor
) const;
249 struct Sc10DataBaseRec
265 sal_Char QueryString0
[64];
271 sal_Char QueryString1
[64];
277 sal_Char QueryString2
[64];
281 // Kopf/Fusszeilen-Beschreibung
282 struct Sc10HeadFootLine
292 Sc10Color RasterColor
;
293 USHORT FrameColor
; // Nibble Codierte Farben link oben rechts unten
296 int operator==( const Sc10HeadFootLine
& rData
) const;
300 struct Sc10PageFormat
302 Sc10HeadFootLine HeadLine
;
303 Sc10HeadFootLine FootLine
;
321 sal_Char PrintAreaName
[32];
322 Sc10BlockRect PrintArea
;
323 sal_Char PrnZoom
[6]; // Pascal 6 Byte Realzahl
325 INT16 RowRepeatStart
;
327 INT16 ColRepeatStart
;
329 sal_Char Reserved
[26];
331 int operator==( const Sc10PageFormat
& rData
) const;
335 struct Sc10TableProtect
337 sal_Char PassWord
[16];
343 struct Sc10SheetProtect
345 sal_Char PassWord
[16];
350 // Dateikopf StarCalc 1.0 Datei
351 struct Sc10FileHeader
353 sal_Char CopyRight
[30];
355 sal_Char Reserved
[32];
358 // Benutzer-Definierte Datei-Beschreibung
365 sal_Char InfoLabel0
[16];
366 sal_Char InfoLabel1
[16];
367 sal_Char InfoLabel2
[16];
368 sal_Char InfoLabel3
[16];
373 sal_Char CreateAuthor
[64];
374 sal_Char ChangeAuthor
[64];
375 sal_Char PrintAuthor
[64];
376 Sc10DateTime CreateDate
;
377 Sc10DateTime ChangeDate
;
378 Sc10DateTime PrintDate
;
379 sal_uInt32 PageCount
;
380 sal_uInt32 ChartCount
;
381 sal_uInt32 PictureCount
;
382 sal_uInt32 GraphCount
;
384 sal_uInt32 NoteCount
;
385 sal_uInt32 TextCellCount
;
386 sal_uInt32 ValueCellCount
;
387 sal_uInt32 FormulaCellCount
;
388 sal_uInt32 CellCount
;
389 sal_Char Reserved
[52];
392 // Letze Cursorposition
393 struct Sc10EditStateInfo
399 // Linke obere Ecke der Tabelle im Fenster
403 // Ueberfluessig in StarCalc 3.0
405 sal_Char Reserved
[51];
415 // ZellAttribut-Beschreibung
421 Sc10ColAttr() : pData(NULL
) {}
425 struct Sc10GraphHeader
427 BYTE Typ
; // Typ der Grafik (Ole-Objekt, Image (Bitmap oder MetaFile), Chart-Object)
428 INT16 CarretX
; // ZellPosition der Grafik
431 INT32 x
; // x,y Abstand zum Zellrand in Pixel (Pixel weil ich Grafiken in Fenstern ablege)
433 INT32 w
; // w,h Breite und Hoehe in Pixel
435 BYTE IsRelPos
; // Ist die Position relativ zur Zelle oder absolute in der Tabelle
436 BYTE DoPrint
; // Soll die Grafik ausgedruckt werden
437 USHORT FrameType
; // Art der Umrandung um die Grafik (Keine, Einfach, Doppelt, Einfach Dick, Doppelt Dick)
438 BYTE IsTransparent
; // Soll der Hintergrund gezeichnet werden
439 Sc10Color FrameColor
; // Umrandungsfarbe als RGB-Wert
440 Sc10Color BackColor
; // Hintergrundfarbe als RGB-Wert
441 sal_Char Reserved
[32]; // Na was wohl
445 struct Sc10ImageHeader
447 sal_Char FileName
[128]; // Dateiname des urspruenglich eingefuegten Bildes
448 INT16 Typ
; // Typ der Grafik (Bitmap oder Metafile)
449 BYTE Linked
; // Kann nicht vorkommen
450 INT16 x1
; // Urspruengliche Groesse der Grafik (nur fuer Metafiles)
454 sal_uInt32 Size
; // Groesse der Grafik in BYTES
458 struct Sc10ChartHeader
460 INT16 MM
; // Meatfile Struktur MapMode, Breite, Hoehe
463 sal_uInt32 Size
; // Groesse der Grafik in BYTES
467 struct Sc10ChartSheetData
469 BYTE HasTitle
; // Hat das Chart Daten aus der Tabell fuer einen Titel
470 INT16 TitleX
; // Zellposition des Titels
472 BYTE HasSubTitle
; // Hat das Chart Daten aus der Tabell fuer einen Untertitel
473 INT16 SubTitleX
; // Zellposition des Untertitels
475 BYTE HasLeftTitle
; // Hat das Chart Daten aus der Tabelle fuer einen Linken-Titel
476 INT16 LeftTitleX
; // Zellposition des Linken-Titels
478 BYTE HasLegend
; // Hat das Chart Daten aus der Tabelle fuer eine Legende
479 INT16 LegendX1
; // Zellen der Legende
483 BYTE HasLabel
; // Hat das Chart Daten aus der Tabelle fuer die Achsbeschriftung
484 INT16 LabelX1
; // Zellen der Achsbeschriftung
488 INT16 DataX1
; // Zellen der Daten
492 sal_Char Reserved
[64];
495 #define AGPie2D 1 // Pie Chart 2D
496 #define AGPie3D 2 // Pie Chart 3D
497 #define AGBar2D 3 // Bar Chart 2D
498 #define AGBar3D 4 // Bar Chart 3D
499 #define AGGantt 5 // Gantt Diagramm
500 #define AGLine 6 // Line Chart
501 #define AGLogLine 7 // Logarythmic-Coordinate Chart
502 #define AGArea 8 // Area Chart
503 #define AGHLC 11 // High-Low-Close Chart
504 #define AGPolar 10 // Polar-Coordinate Chart
506 typedef sal_Char Sc10ChartText
[30];
508 struct Sc10ChartTypeData
515 sal_Char GraphTitle
[80];
516 sal_Char BottomTitle
[80];
517 INT16 SymbolData
[256];
518 INT16 ColorData
[256];
519 INT16 ThickLines
[256];
520 INT16 PatternData
[256];
521 INT16 LinePatternData
[256];
522 INT16 NumGraphStyles
[11];
524 Sc10ChartText LegendText
[256];
533 Sc10ChartText LabelText
[50];
534 sal_Char LeftTitle
[80];
535 sal_Char Reserved
[4646];
540 class Sc10FontData
: public ScDataObject
546 sal_Char FaceName
[32];
548 Sc10FontData( const Sc10FontData
& rData
) :
549 ScDataObject( rData
),
550 Height( rData
.Height
),
551 CharSet( rData
.CharSet
),
552 PitchAndFamily( rData
.PitchAndFamily
)
554 strncpy( FaceName
, rData
.FaceName
, sizeof(FaceName
) );
555 FaceName
[sizeof(FaceName
)-1] = 0;
557 Sc10FontData( SvStream
& rStream
);
558 virtual ScDataObject
* Clone() const { return new Sc10FontData(*this); }
563 class Sc10FontCollection
: public ScCollection
568 Sc10FontCollection( SvStream
& rStream
);
569 ULONG
GetError() { return nError
; }
570 Sc10FontData
* At(USHORT nIndex
) { return (Sc10FontData
*)ScCollection::At(nIndex
); }
572 using ScCollection::At
;
577 class Sc10NameData
: public ScDataObject
581 sal_Char Reference
[64];
582 sal_Char Reserved
[12];
584 Sc10NameData(const Sc10NameData
& rData
) :
585 ScDataObject( rData
)
587 strncpy(Name
, rData
.Name
, sizeof(Name
));
588 Name
[sizeof(Name
)-1] = 0;
589 strncpy(Reference
, rData
.Reference
, sizeof(Reference
));
590 Reference
[sizeof(Reference
)-1] = 0;
591 memcpy(Reserved
, rData
.Reserved
, sizeof(Reserved
));
593 Sc10NameData(SvStream
& rStream
);
594 virtual ScDataObject
* Clone() const { return new Sc10NameData(*this); }
598 // Bereichs-Collection
599 class Sc10NameCollection
: public ScCollection
604 Sc10NameCollection(SvStream
& rStream
);
605 ULONG
GetError() { return nError
; }
606 Sc10NameData
* At(USHORT nIndex
) { return (Sc10NameData
*)ScCollection::At(nIndex
); }
608 using ScCollection::At
;
613 class Sc10PatternData
: public ScDataObject
617 Sc10ValueFormat ValueFormat
;
627 sal_Char Reserved
[8];
629 Sc10PatternData(const Sc10PatternData
& rData
) :
630 ScDataObject( rData
)
632 strncpy(Name
, rData
.Name
, sizeof(Name
));
633 Name
[sizeof(Name
)-1] = 0;
634 memcpy(&ValueFormat
, &rData
.ValueFormat
, sizeof(ValueFormat
));
635 memcpy(&LogFont
, &rData
.LogFont
, sizeof(LogFont
));
637 Justify
= rData
.Justify
;
639 Raster
= rData
.Raster
;
640 nColor
= rData
.nColor
;
641 FrameColor
= rData
.FrameColor
;
643 FormatFlags
= rData
.FormatFlags
;
644 memcpy(Reserved
, rData
.Reserved
, sizeof(Reserved
));
646 Sc10PatternData(SvStream
& rStream
);
647 virtual ScDataObject
* Clone() const { return new Sc10PatternData(*this); }
651 // Vorlage-Collection
652 class Sc10PatternCollection
: public ScCollection
657 Sc10PatternCollection(SvStream
& rStream
);
658 ULONG
GetError() { return nError
; }
659 Sc10PatternData
* At(USHORT nIndex
) { return (Sc10PatternData
*)ScCollection::At(nIndex
); }
661 using ScCollection::At
;
666 class Sc10DataBaseData
: public ScDataObject
669 Sc10DataBaseRec DataBaseRec
;
671 Sc10DataBaseData(const Sc10DataBaseData
& rData
) :
672 ScDataObject( rData
)
674 memcpy(&DataBaseRec
, &rData
.DataBaseRec
, sizeof(DataBaseRec
));
676 Sc10DataBaseData(SvStream
& rStream
);
677 virtual ScDataObject
* Clone() const { return new Sc10DataBaseData(*this); }
681 // DatenBank-Collection
682 class Sc10DataBaseCollection
: public ScCollection
686 sal_Char ActName
[32];
688 Sc10DataBaseCollection(SvStream
& rStream
);
689 ULONG
GetError() { return nError
; }
690 Sc10DataBaseData
* At(USHORT nIndex
) { return (Sc10DataBaseData
*)ScCollection::At(nIndex
); }
692 using ScCollection::At
;
696 class Sc10PageData
: public ScDataObject
699 Sc10PageFormat aPageFormat
;
700 Sc10PageData( const Sc10PageFormat
& rFormat
) : aPageFormat(rFormat
) {}
701 int operator==( const Sc10PageData
& rData
) const
702 { return aPageFormat
== rData
.aPageFormat
; }
703 virtual ScDataObject
* Clone() const;
706 // Seitenformat-Collection
707 class Sc10PageCollection
: public ScCollection
710 Sc10PageCollection() : ScCollection(1,1) {};
711 Sc10PageData
* At(USHORT nIndex
) { return (Sc10PageData
*)ScCollection::At(nIndex
); }
712 USHORT
InsertFormat( const Sc10PageFormat
& rData
);
713 void PutToDoc( ScDocument
* pDoc
);
715 using ScCollection::At
;
719 class ScfStreamProgressBar
;
726 Sc10Color TextPalette
[16];
727 Sc10Color BackPalette
[16];
728 Sc10Color RasterPalette
[16];
729 Sc10Color FramePalette
[16];
730 Sc10SheetProtect SheetProtect
;
731 Sc10FontCollection
* pFontCollection
;
732 Sc10NameCollection
* pNameCollection
;
733 Sc10PatternCollection
* pPatternCollection
;
734 Sc10DataBaseCollection
* pDataBaseCollection
;
738 ScViewOptions aSc30ViewOpt
;
739 ScfStreamProgressBar
* pPrgrsBar
;
742 Sc10Import( SvStream
& rStr
, ScDocument
* pDocument
);
746 void LoadFileHeader();
748 void LoadEditStateInfo();
750 void LoadViewColRowBar();
753 void LoadFontCollection();
754 void LoadNameCollection();
755 void ImportNameCollection();
756 void LoadPatternCollection();
757 void LoadDataBaseCollection();
759 void LoadCol(SCCOL Col
, SCTAB Tab
);
760 void LoadColAttr(SCCOL Col
, SCTAB Tab
);
761 void LoadAttr(Sc10ColAttr
& rAttr
);
762 void ChangeFormat(USHORT nFormat
, USHORT nInfo
, ULONG
& nKey
);